[spirv-writer] Handle output of bitwise xor.

This CL adds bitwise xor support to the spirv writer.

Bug: tint:5
Change-Id: I011283ef12840d25c882b95fc664f2b0dc6003da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19410
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
dan sinclair 2020-04-14 15:04:22 +00:00 committed by dan sinclair
parent 2de7cb978d
commit a51d697f8c
2 changed files with 4 additions and 1 deletions

View File

@ -617,6 +617,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->IsXor()) {
op = spv::Op::OpBitwiseXor;
} else { } else {
return 0; return 0;
} }

View File

@ -123,7 +123,8 @@ INSTANTIATE_TEST_SUITE_P(
BinaryArithIntegerTest, BinaryArithIntegerTest,
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::kXor, "OpBitwiseXor"}));
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>; using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
TEST_P(BinaryArithFloatTest, Scalar) { TEST_P(BinaryArithFloatTest, Scalar) {