[llvm] [GISel][RISCV] Use isSExtCheaperThanZExt when widening G_ICMP. (PR #120032)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 21:46:55 PST 2024


topperc wrote:

> > Curious: why is it correct to do a sign-extend for an unsigned comparison promotion?
> 
> eq / ne / true / false aren't really signed or unsigned, you just need to treat the high bits consistently in both operands

This isn't limited eq / ne / true / false. It works for ugt/uge/ult/ule too.

Sign extending an unsigned value doesn't change 0x00000000-0x7ffffff and it makes 0x8000000-0xffffffff into even larger numbers without affecting their relative order.

https://github.com/llvm/llvm-project/pull/120032


More information about the llvm-commits mailing list