[RISCV] Use default promotion for (i32 (shl 1, X)) on RV64 when Zbs is enabled.
authorCraig Topper <craig.topper@sifive.com>
Thu, 28 Apr 2022 16:21:13 +0000 (09:21 -0700)
committerCraig Topper <craig.topper@sifive.com>
Thu, 28 Apr 2022 16:58:30 +0000 (09:58 -0700)
commitec11fbb1d682e9c3e67eafc036c92fe9200b40f5
tree406f2f371ba34cd88487d315414e1659d243bd8a
parent8b687974842d2c3442091681fb4d3008ef5810a7
[RISCV] Use default promotion for (i32 (shl 1, X)) on RV64 when Zbs is enabled.

This improves opportunities to use bset/bclr/binv. Unfortunately,
there are no W versions of these instrcutions so this isn't always
a clear win. If we use SLLW we get free sign extend and shift masking,
but need to put a 1 in a register and can't remove an or/xor. If
we use bset/bclr/binv we remove the immediate materializationg and
logic op, but might need a mask on the shift amount and sext.w.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D124096
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rv64zbs.ll