Page MenuHomePhabricator

[GlobalISel] Implement lowering for G_ROTR and G_ROTL.
ClosedPublic

Authored by aemerson on Mar 26 2021, 3:46 PM.

Details

Diff Detail

Event Timeline

aemerson created this revision.Mar 26 2021, 3:46 PM
aemerson requested review of this revision.Mar 26 2021, 3:46 PM
foad added inline comments.Mar 29 2021, 2:32 AM
llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
970 ↗(On Diff #333649)

buildConstant already does this.

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5382

What does "Hs" mean?

aemerson added inline comments.Mar 29 2021, 10:37 AM
llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
970 ↗(On Diff #333649)

Indeed it does. The doc for it should make it clearer.

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5382

Good question. This was a port of some code that you wrote in TargetLowering, do you remember?

foad added inline comments.Mar 29 2021, 10:57 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5382

Curses! Actually it predates me and originally comes from D47725. My only guess is that it's a cute way of indicating a reverse shift by "reversing" the letters S H, in which case I think it's too cute, and not in a good way.

I'll leave it up to you whether to change it to something more understandable or not.

aemerson updated this revision to Diff 333975.Mar 29 2021, 1:36 PM
arsenm added inline comments.Mar 29 2021, 2:48 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5372–5374

I believe alternate lowerings based on instruction legality should be split into separate lower* functions. That way custom lowering can pick the strategy itself, and the default function would then use these crude legality heuristics to pick which strategy to use.

aemerson updated this revision to Diff 334023.Mar 29 2021, 5:40 PM

Split out the opposite rotate handling into separate method.

foad accepted this revision.Mar 30 2021, 1:11 AM

Looks fine to me modulo the naming nit.

llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
351

Nit: "opposite" is now the third word we're using for the same thing. The code calls it "reverse", and the equivalent funnel shift function (three lines up) calls it "inverse". Could we standardize on one? I'd vote for "reverse".

This revision is now accepted and ready to land.Mar 30 2021, 1:11 AM
aemerson added inline comments.Mar 30 2021, 9:21 AM
llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
351

Sure, I'll change that before landing.

This revision was landed with ongoing or failed builds.Mar 30 2021, 9:44 AM
This revision was automatically updated to reflect the committed changes.