This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeIntegerTypes] Improve ExpandIntRes_SADDSUBO codegen on targets without SADDO/SSUBO.
ClosedPublic

Authored by craig.topper on Feb 21 2021, 11:53 PM.

Details

Summary

This code creates 3 setccs that need to be expanded. It was
creating a sign bit test as setge X, 0 which is non-canonical.
Canonical would be setgt X, -1. This misses the special case in
IntegerExpandSetCCOperands for sign bit tests that assumes
canonical form. If we don't hit this special case we end up
with a multipart setcc instead of just checking the sign of
the high part.

To fix this I've reversed the polarity of all of the setccs to
setlt X, 0 which is canonical. The rest of the logic should
still work. This seems to produce better code on RISCV which
lacks a setgt instruction.

This probably still isn't the best code sequence we could use here.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 21 2021, 11:53 PM
craig.topper requested review of this revision.Feb 21 2021, 11:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2021, 11:53 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
craig.topper edited the summary of this revision. (Show Details)Feb 22 2021, 2:49 PM
RKSimon accepted this revision.Feb 23 2021, 5:42 AM

LGTM

This revision is now accepted and ready to land.Feb 23 2021, 5:42 AM