From 5ef27afbfb2011056ed9e9af9cfdf2ef30db7d31 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 14 Apr 2020 16:27:01 +0000 Subject: [PATCH] [spirv-reader] Add FMul Bug: tint:3 Change-Id: I2f7f9f451889d394b22bc297d511ee5fe92b7a85 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19502 Reviewed-by: dan sinclair --- src/reader/spirv/function.cc | 2 ++ src/reader/spirv/function_arithmetic_test.cc | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index d035867dbe..a1f92ef16e 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -44,6 +44,8 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) { return ast::BinaryOp::kAdd; case SpvOpFSub: return ast::BinaryOp::kSubtract; + case SpvOpFMul: + return ast::BinaryOp::kMultiply; default: break; } diff --git a/src/reader/spirv/function_arithmetic_test.cc b/src/reader/spirv/function_arithmetic_test.cc index 25e948f93a..888bdbb6e5 100644 --- a/src/reader/spirv/function_arithmetic_test.cc +++ b/src/reader/spirv/function_arithmetic_test.cc @@ -213,6 +213,18 @@ INSTANTIATE_TEST_SUITE_P( "__vec_2__f32", AstFor("v2float_50_60"), "subtract", 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 spirv