This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorize][SVE] Add tests for vectorising conditional loads of invariant addresses
ClosedPublic

Authored by david-arm on Mar 5 2021, 6:27 AM.

Details

Summary

For loops of the form:

void foo(int *a, int *cond, short *inv, long long n) {

for (long long i=0; i<n; ++i) {
  if (cond[i])
    a[i] = *inv;
}

}

we can vectorise for SVE using masked gather loads where the array
of pointers is simply a vector splat of 'inv' and the mask comes
from the condition 'cond[i] != 0'.

This patch simply adds tests upstream to defend this capability.

Diff Detail

Event Timeline

david-arm created this revision.Mar 5 2021, 6:27 AM
david-arm requested review of this revision.Mar 5 2021, 6:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 6:27 AM
david-arm edited the summary of this revision. (Show Details)Mar 5 2021, 6:27 AM
joechrisellis accepted this revision.Mar 5 2021, 7:56 AM

LGTM -- the test is a little noisy but I suppose that's par for the course for this kind of check. 🙂

This revision is now accepted and ready to land.Mar 5 2021, 7:56 AM

LGTM -- the test is a little noisy but I suppose that's par for the course for this kind of check. 🙂

HI @joechrisellis thanks for the review! Yes, I tried to write in as few CHECK lines as I could, but I really wanted to ensure that the inv variable ended up as a splat in the gather and so on. Also, the geps and casts along the way have to be tracked unfortunately to ensure the masked gathers and loads are doing the expected thing.

This revision was landed with ongoing or failed builds.Mar 8 2021, 1:13 AM
This revision was automatically updated to reflect the committed changes.