This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Optimize 32-bit shifts: reverse shift + move
ClosedPublic

Authored by aykevl on Dec 22 2022, 11:21 AM.

Details

Summary

This optimization turns shifts of almost a multiple of 8 into a shift
into the opposite direction. Unfortunately it doesn't compose well with
the other optimizations (I've tried) so it's separate from them.

Diff Detail

Event Timeline

aykevl created this revision.Dec 22 2022, 11:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2022, 11:21 AM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
aykevl requested review of this revision.Dec 22 2022, 11:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2022, 11:21 AM
aykevl updated this revision to Diff 485836.Jan 1 2023, 6:12 PM
  • rebase
benshi001 accepted this revision.Jan 6 2023, 12:38 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Jan 6 2023, 12:38 AM
benshi001 added inline comments.Jan 6 2023, 12:46 AM
llvm/lib/Target/AVR/AVRISelLowering.cpp
1909

a tiny suggestion, this can be const int ShiftRegsIdx = I + 1; .

1969

a tiny suggestion, this can be const int ShiftRegsIdx = I - (Regs.size() - ShiftRegs.size()) - 1; .

This revision was automatically updated to reflect the committed changes.