Add support for OpVectorTimesScalar
This gets us the final few cases in the glsl multiplies group.
Test: dEQP-VK.glsl.operator.binary_operator.mul.*
Bug: b/126873455
Change-Id: Id9ec4ad1754a7e63c8d7e0aa0a0b0b156a03b024
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26651
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 1f4fb38..ad92a3e 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -337,6 +337,7 @@
case spv::OpIsNan:
case spv::OpAny:
case spv::OpAll:
+ case spv::OpVectorTimesScalar:
// Instructions that yield an intermediate value
{
TypeID typeId = insn.word(1);
@@ -1039,6 +1040,10 @@
EmitVectorShuffle(insn, routine);
break;
+ case spv::OpVectorTimesScalar:
+ EmitVectorTimesScalar(insn, routine);
+ break;
+
case spv::OpNot:
case spv::OpSNegate:
case spv::OpFNegate:
@@ -1443,6 +1448,19 @@
}
}
+ void SpirvShader::EmitVectorTimesScalar(InsnIterator insn, SpirvRoutine *routine) const
+ {
+ auto &type = getType(insn.word(1));
+ auto &dst = routine->createIntermediate(insn.word(2), type.sizeInComponents);
+ auto srcLHS = GenericValue(this, routine, insn.word(3));
+ auto srcRHS = GenericValue(this, routine, insn.word(4));
+
+ for (auto i = 0u; i < type.sizeInComponents; i++)
+ {
+ dst.emplace(i, srcLHS[i] * srcRHS[0]);
+ }
+ }
+
void SpirvShader::EmitUnaryOp(InsnIterator insn, SpirvRoutine *routine) const
{
auto &type = getType(insn.word(1));