mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-08 07:33:33 +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;
|
op = lhs_is_float_or_vec ? spv::Op::OpFOrdNotEqual : spv::Op::OpINotEqual;
|
||||||
} else if (expr->IsOr()) {
|
} else if (expr->IsOr()) {
|
||||||
op = spv::Op::OpBitwiseOr;
|
op = spv::Op::OpBitwiseOr;
|
||||||
|
} else if (expr->IsSubtract()) {
|
||||||
|
op = lhs_is_float_or_vec ? spv::Op::OpFSub : spv::Op::OpISub;
|
||||||
} else if (expr->IsXor()) {
|
} else if (expr->IsXor()) {
|
||||||
op = spv::Op::OpBitwiseXor;
|
op = spv::Op::OpBitwiseXor;
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,6 +124,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
||||||
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
||||||
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
||||||
|
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
||||||
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
||||||
|
|
||||||
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
|
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
|
||||||
@ -199,10 +200,11 @@ TEST_P(BinaryArithFloatTest, Vector) {
|
|||||||
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()),
|
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()),
|
||||||
"%5 = " + param.name + " %1 %4 %4\n");
|
"%5 = " + param.name + " %1 %4 %4\n");
|
||||||
}
|
}
|
||||||
INSTANTIATE_TEST_SUITE_P(BuilderTest,
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
BuilderTest,
|
||||||
BinaryArithFloatTest,
|
BinaryArithFloatTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kAdd,
|
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpFAdd"},
|
||||||
"OpFAdd"}));
|
BinaryData{ast::BinaryOp::kSubtract, "OpFSub"}));
|
||||||
|
|
||||||
using BinaryCompareUnsignedIntegerTest = testing::TestWithParam<BinaryData>;
|
using BinaryCompareUnsignedIntegerTest = testing::TestWithParam<BinaryData>;
|
||||||
TEST_P(BinaryCompareUnsignedIntegerTest, Scalar) {
|
TEST_P(BinaryCompareUnsignedIntegerTest, Scalar) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user