This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Optimize multiplication with immediates
ClosedPublic

Authored by benshi001 on Apr 3 2023, 1:02 AM.

Details

Summary

Optimize (mul r, c) to (SLLI (ALSL r, r, i0), i1), in which
c = (1 + (1 << i0)) << i1.

Diff Detail

Event Timeline

benshi001 created this revision.Apr 3 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 1:02 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Apr 3 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 1:02 AM

About the commit message, do you mean:

Optimize (mul r, c) to (SLLI (ALSL r, r, i0), i1)
benshi001 edited the summary of this revision. (Show Details)Apr 3 2023, 1:07 AM

About the commit message, do you mean:

Optimize (mul r, c) to (SLLI (ALSL r, r, i0), i1)

Thanks! Fixed.

SixWeining accepted this revision.Apr 6 2023, 7:41 AM

LGTM except a nit. Thanks.

llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
431

Nit: ALSl r, r, i0

This revision is now accepted and ready to land.Apr 6 2023, 7:41 AM
This revision was landed with ongoing or failed builds.Apr 6 2023, 5:47 PM
This revision was automatically updated to reflect the committed changes.
benshi001 marked an inline comment as done.
benshi001 added inline comments.Apr 6 2023, 5:47 PM
llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
431

Thanks! I have fixed it before doing git push.