This is an archive of the discontinued LLVM Phabricator instance.

[VP][VE] Default VP_SREM/UREM to Expand and add generic expansion using VP_SDIV/UDIV+VP_MUL+VP_SUB.
ClosedPublic

Authored by craig.topper on Sep 8 2022, 11:53 AM.

Details

Summary

I want to default all VP operations to Expand. These 2 were blocking
because VE doesn't support them and the tests were expecting them
to fail a specific way. Using Expand caused them to fail differently.

Seemed better to emulate them using operations that are supported.

@simoll mentioned on Discord that VE has some expansion downstream. Not
sure if its done like this or in the VE target.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 8 2022, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2022, 11:53 AM
craig.topper requested review of this revision.Sep 8 2022, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2022, 11:53 AM
efocht accepted this revision.Sep 15 2022, 12:48 AM

The expansion in the downstream code for VE does exactly the same thing like the proposed changes.
The code generated for the tests also looks good. Thanks for implementing this!

This revision is now accepted and ready to land.Sep 15 2022, 12:48 AM
frasercrmck accepted this revision.Sep 15 2022, 1:58 AM

LGTM

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
1339

I'd prefer something like the comment in DivRemPairs as it's a little clearer: // X % Y --> X - ((X / Y) * Y).

This revision was landed with ongoing or failed builds.Sep 16 2022, 1:19 PM
This revision was automatically updated to reflect the committed changes.