Commit Graph

2 Commits

Author SHA1 Message Date
Craig Topper 4477500533 [RISCV] ISel (and (shift X, C1), C2)) to shift pair in more cases
Previously, these isel optimizations were disabled if the AND could
be selected as a ANDI instruction. This patch disables the optimizations
only if the immediate is valid for C.ANDI. If we can't use C.ANDI,
we might be able to compress the shift instructions instead.

I'm not checking the C extension since we have relatively poor test
coverage of the C extension. Without C extension the code size
should be equal. My only concern would be if the shift+andi had
better latency/throughput on a particular CPU.

I did have to add a peephole to match SRLIW if the input is zexti32
to prevent a regression in rv64zbp.ll.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D122701
2022-03-30 11:46:42 -07:00
Chenbing Zheng 780eb9f586 [DAGCombine] add tests for bitreverse-shift optimization
This patch add some tests to show some optimization opportunities
for bitreverse-shift.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D121507
2022-03-30 09:50:28 +08:00