This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Add lowering for fixed length vector and, or & xor operations.
ClosedPublic

Authored by paulwalker-arm on Aug 3 2020, 3:44 AM.

Details

Summary

Since there are no ill effects when performing these operations
with undefined elements, they are lowered to the already supported
unpredicated scalable vector equivalents.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Aug 3 2020, 3:44 AM
paulwalker-arm requested review of this revision.Aug 3 2020, 3:44 AM

I have mixed feelings out this patch. Ideally I would like everything lowered to _PRED nodes and then let ISel decide which instruction best does the job. Unfortunately I could not see a clear way to write a pattern where one of the inputs is ignored. Am I missing something obvious here? if not then I guess this patch will have to do.

I have mixed feelings out this patch. Ideally I would like everything lowered to _PRED nodes and then let ISel decide which instruction best does the job. Unfortunately I could not see a clear way to write a pattern where one of the inputs is ignored. Am I missing something obvious here? if not then I guess this patch will have to do.

I think you're looking for something like immAllOnesV. So you'd use XXX_PRED and pass an all-1s mask. Then a pattern would be needed to match it to the unpredicated instruction. Something roughly like this:

def : Pat<(XOR_PRED (mask_vt immAllOnesV), ZPR:$src1, ZPR:$src2),
          (XOR ZPR:$src1, ZPR:$src2)>;

Thanks @cameron.mcinally. Yes immAllOnesV is similar to what I'm after but I didn't want to restrict it to the all-1s mask. I had some success creating "any_frag" but then had to implement a bunch of combines and extra lowering which we loose when moving away from the unpredicated ISD nodes. On reflection since SVE already supports most instruction formats when it comes to the logical operations I'm thinking this isn't really the patch to introduce "any_frag" so if it's OK I'd like to promote this patch as the correct way to handle these operations.

This revision is now accepted and ready to land.Aug 4 2020, 7:24 AM
This revision was landed with ongoing or failed builds.Aug 5 2020, 3:31 AM
This revision was automatically updated to reflect the committed changes.