[llvm] [AArch64][GlobalISel] Take abs scalar codegen closer to SDAG (PR #84886)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 10:42:54 PDT 2024


madhur13490 wrote:

> Given we have a csneg instruction, do we just want `cmp x, 0; csneg x, x`? i.e I would expect us to want to lower to a compare+neg+select (which isn't either of the existing lowerAbs* methods, and might not be easy to tell generically that we want to generate code for, if there is not an obvious way to check for csneg).

@davemgreen Yes, I was experimenting with this idea locally after this patch but was running into legalizing G_SELECT issue. I have fixed it now and the new commit now introduces cneg-based lowering. Please have a look.

@arsenm @aemerson Given that there is a different approach now, do you still think `lower()` should be modified? If so, how do we reliably detect? Can you please elaborate a bit more?

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


More information about the llvm-commits mailing list