[llvm] [InstCombine] Fold `(x == y) ? 0 : (x > y ? 1 : -1)` into `ucmp/scmp(x,y)` (PR #107314)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 03:13:44 PDT 2024
nikic wrote:
> By inverse fold for you mean `x !- y ? x > y ? 1 : -1 : 0` or `x > y ? 1 : x == y ? 0 : -1`?
It looks like this gets canonicalized: https://llvm.godbolt.org/z/7xTGM85G6 Probably good to add tests for that variant, but shouldn't need code changes.
https://github.com/llvm/llvm-project/pull/107314
More information about the llvm-commits
mailing list