diff options
author | Piotr Fusik <p.fusik@samsung.com> | 2025-04-10 09:08:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-10 09:08:08 +0200 |
commit | 807cc3791fabd47bd24d57a8e4ab7df9117b3ede (patch) | |
tree | 56d67ac2b8d48246a3681275cfb42d6bb6b3a370 /llvm/lib/CodeGen/ModuloSchedule.cpp | |
parent | 3fd0d22d74027c00bd2365ea1691dc530bb9709a (diff) | |
download | llvm-807cc3791fabd47bd24d57a8e4ab7df9117b3ede.zip llvm-807cc3791fabd47bd24d57a8e4ab7df9117b3ede.tar.gz llvm-807cc3791fabd47bd24d57a8e4ab7df9117b3ede.tar.bz2 |
[DAGCombiner] Fold subtraction if above threshold to `umin` (#134235)
Folds patterns such as:
unsigned foo(unsigned x, unsigned y) {
return x >= y ? x - y : x;
}
Before, on RISC-V:
sltu a2, a0, a1
addi a2, a2, -1
and a1, a1, a2
subw a0, a0, a1
Or, with Zicond:
sltu a2, a0, a1
czero.nez a1, a1, a2
subw a0, a0, a1
After, with Zbb:
subw a1, a0, a1
minu a0, a0, a1
Only applies to unsigned comparisons.
If `x >= y` then `x - y` is less than or equal `x`.
Otherwise, `x - y` wraps and is greater than `x`.
Diffstat (limited to 'llvm/lib/CodeGen/ModuloSchedule.cpp')
0 files changed, 0 insertions, 0 deletions