Page MenuHomePhabricator

[ARM] Lower "(x<<c) > 0x80000000U" to "lsls" on Thumb1.
ClosedPublic

Authored by efriedma on Jul 26 2019, 2:48 PM.

Details

Summary

This is extremely specific, but saves three instructions when it's legal. I don't think the code can be usefully generalized.

Depends on D65175.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Jul 26 2019, 2:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2019, 2:48 PM
This revision is now accepted and ready to land.Jul 29 2019, 2:46 AM

Would this also be profitable for Thumb2?

Would this also be profitable for Thumb2?

I think it saves only one instruction on ARM/Thumb2 ("cmp rN, #0x80000000" is legal). Still worthwhile, I guess, assuming there isn't some sort of performance penalty for branching based on a shift. But I'd also have to figure out the right heuristics for D65175, since the transforms interact, and do a little more implementation work to lower ARMISD::LSLS. I'll leave a FIXME.

This revision was automatically updated to reflect the committed changes.