Page MenuHomePhabricator

[RISCV][LegalizeTypes] Teach type legalizer that it can promote UMIN/UMAX using SExtPromotedInteger if that's better for the target.

Authored by craig.topper on Nov 25 2020, 1:05 PM.



If Sext is cheaper than Zext for a target, we can use that to promote the operands of UMIN/UMAX. Using sext just makes numbers with the sign bit set even larger when treated as an unsigned number and it has no effect on number without the sign bit set. So the relative order doesn't change. This is similar to what we already do for promoting SETCC.

This is helpful on RISCV where i32 arguments are sign extended on RV64 and many instructions are able to produce results with 33 sign bits.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 25 2020, 1:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 1:05 PM
craig.topper requested review of this revision.Nov 25 2020, 1:05 PM
This revision is now accepted and ready to land.Nov 26 2020, 10:22 AM
frasercrmck accepted this revision.Nov 27 2020, 1:44 AM

Nice. LGTM.