This is an archive of the discontinued LLVM Phabricator instance.

[Codegen] Alter the default promotion for add_sat and sub_sat
ClosedPublic

Authored by dmgreen on Oct 13 2019, 2:10 AM.

Details

Summary

This is round 2 of D68643. The values were not being sign extended or zero extended correctly, which could lead to incorrect results when the incoming values were not already extended. They are needed because the min/max need no superfluous values in the higher bits.

I've fixed that and added some extra tests. Not everything here is an improvement (although most of it still is). Some of the i4 cases look slightly larger, but this may be improved in cases where the extend can become free (from a load, for example).

Diff Detail

Event Timeline

dmgreen created this revision.Oct 13 2019, 2:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2019, 2:10 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic accepted this revision.Oct 14 2019, 12:34 PM

LGTM

Overall this still looks good, and some of the tests (like AArch64/*_sat.ll) would look better than they do right now with appropriate zeroext/signext attributes. I think it's reasonable to expect that extension will often be free when doing promotion.

This revision is now accepted and ready to land.Oct 14 2019, 12:34 PM
This revision was automatically updated to reflect the committed changes.