mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-08 06:05:55 +00:00
[spirv-writer] Handle binary and expression.
This CL updates the binary expression to handle the bitwise and command. Bug: tint:5 Change-Id: I64d53d6aaa1de2fd9ec7959bf084f30736146d78 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19408 Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
f558809b54
commit
f95862b806
@ -575,7 +575,9 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) {
|
|||||||
(lhs_type->IsVector() && lhs_type->AsVector()->type()->IsU32());
|
(lhs_type->IsVector() && lhs_type->AsVector()->type()->IsU32());
|
||||||
|
|
||||||
spv::Op op = spv::Op::OpNop;
|
spv::Op op = spv::Op::OpNop;
|
||||||
if (expr->IsAdd()) {
|
if (expr->IsAnd()) {
|
||||||
|
op = spv::Op::OpBitwiseAnd;
|
||||||
|
} else if (expr->IsAdd()) {
|
||||||
op = lhs_is_float_or_vec ? spv::Op::OpFAdd : spv::Op::OpIAdd;
|
op = lhs_is_float_or_vec ? spv::Op::OpFAdd : spv::Op::OpIAdd;
|
||||||
} else if (expr->IsEqual()) {
|
} else if (expr->IsEqual()) {
|
||||||
op = lhs_is_float_or_vec ? spv::Op::OpFOrdEqual : spv::Op::OpIEqual;
|
op = lhs_is_float_or_vec ? spv::Op::OpFOrdEqual : spv::Op::OpIEqual;
|
||||||
|
@ -118,10 +118,11 @@ TEST_P(BinaryArithIntegerTest, 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(
|
||||||
BinaryArithIntegerTest,
|
BuilderTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kAdd,
|
BinaryArithIntegerTest,
|
||||||
"OpIAdd"}));
|
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
||||||
|
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"}));
|
||||||
|
|
||||||
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
|
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
|
||||||
TEST_P(BinaryArithFloatTest, Scalar) {
|
TEST_P(BinaryArithFloatTest, Scalar) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user