Commit 5fcdf76
committed
[RISCV] Optimize (brcond (seteq (and X, (1 << C)-1), 0))
Inspired by gcc's assembly: https://godbolt.org/z/54hbzsGYn, while referring to D130203
Replace AND+IMM{32,64} with a slli.
But gcc does not handle 0xffff and 0xffffffff, which also seem to be optimizable.
The testcases copies all the bits in D130203 and adds 16, 32, and 64 bits.
Differential Revision: https://reviews.llvm.org/D1416071 parent 0ef58c6 commit 5fcdf76
File tree
4 files changed
+1630
-11
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV
4 files changed
+1630
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1534 | 1534 | | |
1535 | 1535 | | |
1536 | 1536 | | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
1540 | 1546 | | |
1541 | 1547 | | |
1542 | 1548 | | |
| |||
0 commit comments