diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index a1f92ef16e..0f24f1280f 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -46,6 +46,8 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) { return ast::BinaryOp::kSubtract; case SpvOpFMul: return ast::BinaryOp::kMultiply; + case SpvOpFDiv: + return ast::BinaryOp::kDivide; default: break; } diff --git a/src/reader/spirv/function_arithmetic_test.cc b/src/reader/spirv/function_arithmetic_test.cc index 888bdbb6e5..1643aa2f83 100644 --- a/src/reader/spirv/function_arithmetic_test.cc +++ b/src/reader/spirv/function_arithmetic_test.cc @@ -226,6 +226,19 @@ INSTANTIATE_TEST_SUITE_P( "__vec_2__f32", AstFor("v2float_50_60"), "multiply", AstFor("v2float_60_50")})); +INSTANTIATE_TEST_SUITE_P( + SpvParserTest_FDiv, + SpvBinaryTest, + ::testing::Values( + // Scalar float + BinaryData{"float", "float_50", "OpFDiv", "float_60", "__f32", + "ScalarConstructor{50.000000}", "divide", + "ScalarConstructor{60.000000}"}, + // Vector float + BinaryData{"v2float", "v2float_50_60", "OpFDiv", "v2float_60_50", + "__vec_2__f32", AstFor("v2float_50_60"), "divide", + AstFor("v2float_60_50")})); + } // namespace } // namespace spirv } // namespace reader