This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add versions of the avx512 gather intrinsics that take the mask as a vXi1 vector instead of a scalar
ClosedPublic

Authored by craig.topper on Jan 9 2019, 6:29 PM.

Details

Summary

In keeping with our general direction of having the vXi1 type present in IR, this patch converts the mask argument for avx512 gather to vXi1. This can avoid k-register to GPR to k-register transitions late in codegen.

I left the existing intrinsics behind because they have many out of tree users such as ISPC. They generate their own code and don't go through the autoupgrade path which only works for bitcode and ll parsing. Ideally we will get them to migrate to target independent intrinsics, but it might be easier for them to migrate to these new intrinsics.

I'll work on scatter and gatherpf/scatterpf after next. Hopefully we can get this all done for 8.0 so we can maybe migrate everyone before 9.0.

Diff Detail

Repository
rL LLVM

Event Timeline

I'm not sure its a good idea to completely lose the CHECKs from the intrinsic tests

Oops that was a mistake. I meant to regenerate after using the autoupgrade code to get the new IR out of opt.

Add back the check lines. Make a copy of the test for the old intrinsics.

Fix accidental renaming of the tests that prevented the script from working

I'm not totally clear on what relationship these have to the generic gather intrinsics: llvm.masked.gather.* - shouldn't we be trying to use those? The vector of pointers vs base pointer + vector of indices I guess is the issue?

Yeah that’s the issue. The software interface for the intrinsics passes base, index, and scale separately. The generic intrinsics expect a GEP they can extract the info from. I suppose with the right casting we could form a GEP, but that seems ugly.

I do want to push the out of tree users to use the generic versions where possible since they’re doing something similar to the loop vectorizer rather than the software intrinsics. So they should be better able to form a vector GEP from the scalar GEP they probably already have.

RKSimon accepted this revision.Jan 15 2019, 9:34 AM

LGTM - ideally we'd have a way for people to call autoupgrade directly for cases like this and just remove them, but looks ok as long as these aren't going to linger over too many versions (ironically like autoupgrade......).

This revision is now accepted and ready to land.Jan 15 2019, 9:34 AM
This revision was automatically updated to reflect the committed changes.