This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Combine GREVI sequences
ClosedPublic

Authored by frasercrmck on Nov 20 2020, 9:22 AM.

Details

Summary

This combine step performs the following type of transformation:

rev.p a0, a0   # grevi a0, a0, 0b01
rev2.n a0, a0  # grevi a0, a0, 0b10
-->
rev.n a0, a0   # grevi a0, a0, 0b11

Diff Detail

Event Timeline

frasercrmck created this revision.Nov 20 2020, 9:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2020, 9:22 AM
frasercrmck requested review of this revision.Nov 20 2020, 9:22 AM
craig.topper added inline comments.Nov 20 2020, 10:03 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1374

Does the order matter? Or do we just need (ShAmt1 & ShAmt2) == 0 to hold?

craig.topper added inline comments.Nov 20 2020, 10:09 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1374

Maybe we don't even need (ShAmt1 & ShAmt2) == 0 if we XOR the constants. Maybe folding 0 to GREVSrc.

frasercrmck added inline comments.Nov 23 2020, 7:40 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1374

You're right; the order isn't important. Not sure what I was thinking. XORing seems like the best way to go.

removed ordering & simplified logic. added extra test.

This revision is now accepted and ready to land.Nov 23 2020, 11:39 AM
This revision was landed with ongoing or failed builds.Nov 24 2020, 4:12 AM
This revision was automatically updated to reflect the committed changes.