[llvm] [RISCV] and x (sub 0, y) -> andn x y (PR #129253)

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 06:56:04 PST 2025


spaits wrote:

In this first attempt I have played it safe. I would be open to more generic solutions, if you think that would be nice.

Maybe use the target hook `TargetLowering::hasAndNot` and do some transformations if that returns with true?
But still, even if we have that, we can not be sure, that the given target uses two complement-s to represent negative numbers and I have not found any target hook that would give me information about negative number representation. Probably I just haven't looked hard enough.

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


More information about the llvm-commits mailing list