Skip to content

NCG: Do more efficient comparisons against zero.

In #19636 (comment 343934) @ekmett used code like this for checking the sign of a value

case (y# <# 0#) of
   neg -> ...

I would expect that kind of pattern to not be rare.

Currently this compiles to this assembly:

testq %rsi,%rsi
setl %al 
movzbl %al,%eax

And he suggestes we should generate something like this instead:

rolq $1,%eax
and %eax,$1

I agree.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information