Commit 1a4c7121 by Chris Forbes

Add support for OpFRem

This is the `other` remainder from OpFMod, which we already had. Uses the existing RValue<Float4> % RValue<Float4> operator wiring; the only plumbing I had to fix was that llvm emits a call to fmodf, which was made available in ExternalFunctionSymbolResolver. Test: dEQP-VK.spirv_assembly.instruction.compute.opfrem.all Test: dEQP-VK.spirv_assembly.instruction.graphics.frem.* Bug: b/126873455 Change-Id: I81fbfd8f9e5cab6ac2f16319edda031a122e3a4d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27370Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 0e4d6ffb
......@@ -330,6 +330,7 @@ namespace sw
case spv::OpFMul:
case spv::OpFDiv:
case spv::OpFMod:
case spv::OpFRem:
case spv::OpFOrdEqual:
case spv::OpFUnordEqual:
case spv::OpFOrdNotEqual:
......@@ -1141,6 +1142,7 @@ namespace sw
case spv::OpFMul:
case spv::OpFDiv:
case spv::OpFMod:
case spv::OpFRem:
case spv::OpFOrdEqual:
case spv::OpFUnordEqual:
case spv::OpFOrdNotEqual:
......@@ -1770,6 +1772,9 @@ namespace sw
// TODO(b/126873455): inaccurate for values greater than 2^24
dst.emplace(i, lhs.Float(i) - rhs.Float(i) * Floor(lhs.Float(i) / rhs.Float(i)));
break;
case spv::OpFRem:
dst.emplace(i, lhs.Float(i) % rhs.Float(i));
break;
case spv::OpFOrdEqual:
dst.emplace(i, CmpEQ(lhs.Float(i), rhs.Float(i)));
break;
......
......@@ -553,6 +553,7 @@ namespace rr
func_.emplace("truncf", reinterpret_cast<void*>(truncf));
func_.emplace("printf", reinterpret_cast<void*>(printf));
func_.emplace("puts", reinterpret_cast<void*>(puts));
func_.emplace("fmodf", reinterpret_cast<void*>(fmodf));
}
void *findSymbol(const std::string &name) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment