Commit e1ccb9a9 by Chris Forbes Committed by Ben Clayton

SpirvShader: Optimize SIMD::Pointer load of static equal offsets

Bug: b/135609394 Change-Id: Ica8267cf4e2c09952282f0902c781c2544e4564c Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33188 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 759ad65a
......@@ -294,6 +294,19 @@ namespace sw
mask &= ptr.isInBounds(sizeof(float)); // Disable OOB reads.
if (!atomic && order == std::memory_order_relaxed)
{
if (ptr.hasStaticEqualOffsets())
{
// Load one, replicate.
// Be careful of the case where the post-bounds-check mask
// is 0, in which case we must not load.
T out = T(0);
If(AnyTrue(mask))
{
EL el = *rr::Pointer<EL>(ptr.base + ptr.staticOffsets[0], sizeof(float));
out = T(el);
}
return out;
}
if (ptr.hasStaticSequentialOffsets(sizeof(float)))
{
return rr::MaskedLoad(rr::Pointer<T>(ptr.base + ptr.staticOffsets[0]), mask, sizeof(float));
......
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