[spirv-reader] Handle OpFMul instructions
Bug: tint:1907
Change-Id: I0337b47ba54a9c828b0db8053310e1ea7ef14e60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/186861
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/spirv/reader/parser/binary_test.cc b/src/tint/lang/spirv/reader/parser/binary_test.cc
index cab887b..eefea4e 100644
--- a/src/tint/lang/spirv/reader/parser/binary_test.cc
+++ b/src/tint/lang/spirv/reader/parser/binary_test.cc
@@ -106,6 +106,28 @@
"vec4f",
"OpFAdd",
"%5:vec4<f32> = add %3, %4",
+ },
+
+ // OpFMul
+ BinaryCase{
+ "f16",
+ "OpFMul",
+ "%5:f16 = mul %3, %4",
+ },
+ BinaryCase{
+ "f32",
+ "OpFMul",
+ "%5:f32 = mul %3, %4",
+ },
+ BinaryCase{
+ "vec3h",
+ "OpFMul",
+ "%5:vec3<f16> = mul %3, %4",
+ },
+ BinaryCase{
+ "vec4f",
+ "OpFMul",
+ "%5:vec4<f32> = mul %3, %4",
}),
PrintBuiltinCase);
diff --git a/src/tint/lang/spirv/reader/parser/parser.cc b/src/tint/lang/spirv/reader/parser/parser.cc
index b4f2f16..04622de 100644
--- a/src/tint/lang/spirv/reader/parser/parser.cc
+++ b/src/tint/lang/spirv/reader/parser/parser.cc
@@ -515,6 +515,9 @@
case spv::Op::OpFAdd:
EmitBinary(inst, core::BinaryOp::kAdd);
break;
+ case spv::Op::OpFMul:
+ EmitBinary(inst, core::BinaryOp::kMultiply);
+ break;
case spv::Op::OpFunctionCall:
EmitFunctionCall(inst);
break;