[spirv-reader] Add FMul

Bug: tint:3
Change-Id: I2f7f9f451889d394b22bc297d511ee5fe92b7a85
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19502
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-04-14 16:27:01 +00:00 committed by dan sinclair
parent 31d9036769
commit 5ef27afbfb
2 changed files with 14 additions and 0 deletions

View File

@ -44,6 +44,8 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) {
return ast::BinaryOp::kAdd; return ast::BinaryOp::kAdd;
case SpvOpFSub: case SpvOpFSub:
return ast::BinaryOp::kSubtract; return ast::BinaryOp::kSubtract;
case SpvOpFMul:
return ast::BinaryOp::kMultiply;
default: default:
break; break;
} }

View File

@ -213,6 +213,18 @@ INSTANTIATE_TEST_SUITE_P(
"__vec_2__f32", AstFor("v2float_50_60"), "subtract", "__vec_2__f32", AstFor("v2float_50_60"), "subtract",
AstFor("v2float_60_50")})); AstFor("v2float_60_50")}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_FMul,
SpvBinaryTest,
::testing::Values(
// Scalar float
BinaryData{"float", "float_50", "OpFMul", "float_60", "__f32",
"ScalarConstructor{50.000000}", "multiply",
"ScalarConstructor{60.000000}"},
// Vector float
BinaryData{"v2float", "v2float_50_60", "OpFMul", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "multiply",
AstFor("v2float_60_50")}));
} // namespace } // namespace
} // namespace spirv } // namespace spirv