From 2de7cb978df8631090fb7adc8ea08afff273cf67 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 14 Apr 2020 15:04:11 +0000 Subject: [PATCH] [spirv-writer] Handle bitwise or expression. This CL adds output of the bitwise or command. Bug: tint:5 Change-Id: Iad9bafaa0a8394494615922c14c2d33d2d5701bb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19409 Reviewed-by: Ryan Harrison --- src/writer/spirv/builder.cc | 2 ++ src/writer/spirv/builder_binary_expression_test.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc index 408ea4b2eb..1bdb0adb9c 100644 --- a/src/writer/spirv/builder.cc +++ b/src/writer/spirv/builder.cc @@ -615,6 +615,8 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) { } } else if (expr->IsNotEqual()) { op = lhs_is_float_or_vec ? spv::Op::OpFOrdNotEqual : spv::Op::OpINotEqual; + } else if (expr->IsOr()) { + op = spv::Op::OpBitwiseOr; } else { return 0; } diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc index 8da3eb8c49..2ee5a0e938 100644 --- a/src/writer/spirv/builder_binary_expression_test.cc +++ b/src/writer/spirv/builder_binary_expression_test.cc @@ -122,7 +122,8 @@ INSTANTIATE_TEST_SUITE_P( BuilderTest, BinaryArithIntegerTest, testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"}, - BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"})); + BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"}, + BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"})); using BinaryArithFloatTest = testing::TestWithParam; TEST_P(BinaryArithFloatTest, Scalar) {