Commit d75b837
authored
[RISCV] Support umin/umax in tryFoldSelectIntoOp (#157548)
The neutral values for these are -1U, and 0 respectively. We already
have good arithmetic lowerings for selects with one arm equal to these
values. smin/smax are a bit harder, and will be a separate change.
Somewhat surprisingly, this looks to be a net code improvement in all of
the configurations. With both zbb, it's a clear win. With only zicond,
we still seem to come out ahead because we reduce the number of ziconds
needed (since we lower min/max to them). Without either zbb or zicond,
we're a bit more of wash, but the available arithmetic sequences are
good enough that doing the select unconditionally before using branches
for the min/max is probably still worthwhile?1 parent a848008 commit d75b837
File tree
2 files changed
+286
-436
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV
2 files changed
+286
-436
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18839 | 18839 | | |
18840 | 18840 | | |
18841 | 18841 | | |
| 18842 | + | |
| 18843 | + | |
18842 | 18844 | | |
18843 | 18845 | | |
18844 | 18846 | | |
| |||
0 commit comments