diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc index 1bdb0adb9c..dac803a429 100644 --- a/src/writer/spirv/builder.cc +++ b/src/writer/spirv/builder.cc @@ -617,6 +617,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->IsXor()) { + op = spv::Op::OpBitwiseXor; } else { return 0; } diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc index 2ee5a0e938..796ec8f1b0 100644 --- a/src/writer/spirv/builder_binary_expression_test.cc +++ b/src/writer/spirv/builder_binary_expression_test.cc @@ -123,7 +123,8 @@ INSTANTIATE_TEST_SUITE_P( BinaryArithIntegerTest, testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"}, BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"}, - BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"})); + BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"}, + BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"})); using BinaryArithFloatTest = testing::TestWithParam; TEST_P(BinaryArithFloatTest, Scalar) {