This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use LBU for extloadi8.
ClosedPublic

Authored by craig.topper on Mar 16 2023, 8:04 PM.

Details

Summary

The Zcb extension has c.lbu, but not c.lb. This patch makes us
prefer LBU over LB if we have a choice which will enable more
compression opportunities.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 16 2023, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2023, 8:04 PM
craig.topper requested review of this revision.Mar 16 2023, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2023, 8:04 PM

Are there any cases like with all the *W optimisations where it would be better to sign-extend, or is i32 special there due to the *W ops and for i8 the only cases where it's beneficial will already have become sextloads?

Are there any cases like with all the *W optimisations where it would be better to sign-extend, or is i32 special there due to the *W ops and for i8 the only cases where it's beneficial will already have become sextloads?

I think i32 is special. And right now we don't have any optimizations after isel that notice a difference between lbu and lb. For SExtWRemoval they are both viewed as producing a value that has more than 33 sign bits.

asb accepted this revision.Mar 17 2023, 10:18 AM

LGTM.

This revision is now accepted and ready to land.Mar 17 2023, 10:18 AM
This revision was automatically updated to reflect the committed changes.