This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize add in the zba extension with SH*ADD
ClosedPublic

Authored by benshi001 on Aug 17 2021, 1:26 AM.

Details

Summary

Optimize (add x, c) to (SH*ADD (c>>b), x) if c
is not simm12 while (c>>b) is simm12 and c has
b trailing zeros.

Diff Detail

Event Timeline

benshi001 created this revision.Aug 17 2021, 1:26 AM
benshi001 requested review of this revision.Aug 17 2021, 1:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2021, 1:26 AM
benshi001 edited the summary of this revision. (Show Details)Aug 17 2021, 1:30 AM

Wouldn't this also work for the sh1add case? If so, any reason for omitting from this patch?

Wouldn't this also work for the sh1add case? If so, any reason for omitting from this patch?

We have already optimized (add x, 4094) to (ADDI (ADDI x, 2047), 2047), so SH1ADD is not no long needed.

luismarques accepted this revision.Aug 20 2021, 5:46 AM

We have already optimized (add x, 4094) to (ADDI (ADDI x, 2047), 2047), so SH1ADD is not no long needed.

Oh, right. You even mentioned in the comments the "PatLeaf AddiPair".

LGTM.

This revision is now accepted and ready to land.Aug 20 2021, 5:46 AM
This revision was automatically updated to reflect the committed changes.