This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] SelectionDAG Funnel Shift Lowering
ClosedPublic

Authored by chuongg3 on Jul 18 2023, 1:19 AM.

Details

Summary

Selection DAG:
Does not lower FSHR if the amount of shifts is a constant.
Lowers FSHL to FSHR instead of EXTR.

Diff Detail

Event Timeline

chuongg3 created this revision.Jul 18 2023, 1:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 1:19 AM
chuongg3 requested review of this revision.Jul 18 2023, 1:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 1:19 AM

Thanks. Can you go through and remove the commented out code, and format the rest?

It looks like there is one nice improvement and one regression, (which is in BE i20 vector expansion).

chuongg3 updated this revision to Diff 541416.Jul 18 2023, 2:45 AM

Removed commented out code
Formatted remaining code

Remember to upload with context. It can make the patches easier to read, thanks.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
5805

Can you expand this comment a little to say that it treats fshr with constant shifts as legal, fshl is converted to fshr and the others are expanded.

Does it need to check that the constant is within the right range? Or does that happen automatically somehow?

5810

dl is used in several places in this file, but in general llvm prefers CamelCase for variable names, which for this would make it DL.

5814

newShiftNo -> NewShiftNo

chuongg3 updated this revision to Diff 542802.Jul 21 2023, 1:48 AM
chuongg3 marked 2 inline comments as done.
dmgreen accepted this revision.Jul 24 2023, 5:20 AM

I looked into the BE i20 case but considering how narrow in scope it is, I think this will be OK.

LGTM, with a couple of extra suggestions.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
-25

unsigned on its own is commonly used in LLVM as a type.

-31

I'm not sure what this comment means. Is it just explaining that the funnel shifts with constant shift amounts are legal or converted to FSHR?

This revision is now accepted and ready to land.Jul 24 2023, 5:20 AM
This revision was landed with ongoing or failed builds.Jul 28 2023, 3:57 AM
This revision was automatically updated to reflect the committed changes.
chuongg3 marked 3 inline comments as done.