[llvm] [llvm][InstCombine] Fold signum(x) into scmp(x, 0) (PR #143445)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 14:11:36 PDT 2025


AZero13 wrote:

> > Irrelevant to this PR in itself, but I did notice when running both src in tgt in llc, but why does llc lower the src in the alive2 posted better than the intrinsic?
> 
> I'm guessing you mean on X86. It looks neutral on RISC-V and scmp looks better for AArch64.

Yeah, might have to work on that.

I mean human written asm for this in particular is:

  add edi, edi
  setnz cl
  sbb eax, eax
  or al, cl
  ret
  
  but I do not know if I can get the compiler to lower that to this.

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


More information about the llvm-commits mailing list