Page MenuHomePhabricator

[RISCV] Add missing patterns for rotr with immediate for Zbb/Zbp extensions.

Authored by craig.topper on Nov 1 2020, 3:50 PM.



DAGCombine doesn't canonicalize rotl/rotr with immediate so we
need patterns for both.

Remove the custom matcher for rotl to RORI and just use a SDNodeXForm
to convert the immediate instead.. Doing this gives priority to the
rev32/rev16 versions of grevi over rori since an explicit immediate
is more precise than any immediate. I also added rotr patterns for
rev32/rev16. And removed the (or (shl), (shr)) patterns that should be
combined to rotl by DAG combine.

There is at least one other grev pattern than probably needs a
another rotr pattern, but we need more test coverage first.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 1 2020, 3:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2020, 3:50 PM
craig.topper requested review of this revision.Nov 1 2020, 3:50 PM
craig.topper edited the summary of this revision. (Show Details)Nov 1 2020, 3:56 PM
frasercrmck accepted this revision.Nov 3 2020, 12:59 AM

LGTM otherwise.


As far as I can tell, Subtarget->getXLen() would do the job here. However, I also see that uimmlog2xlen uses is64Bit so I'm not sure what to recommend.

This revision is now accepted and ready to land.Nov 3 2020, 12:59 AM
This revision was landed with ongoing or failed builds.Nov 3 2020, 10:05 AM
This revision was automatically updated to reflect the committed changes.