[spirv-reader] Add FDiv

Change-Id: Ie24bb91276340afd77009165af471ce0f53cca39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19503
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-04-14 16:27:26 +00:00 committed by dan sinclair
parent 5ef27afbfb
commit 74d97e7282
2 changed files with 15 additions and 0 deletions

View File

@ -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;
}

View File

@ -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