[RISCV] Improve detection of when to skip (and (srl x, c2) c1) -> (srli (slli x,...
authorCraig Topper <craig.topper@sifive.com>
Wed, 16 Mar 2022 20:57:21 +0000 (13:57 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 16 Mar 2022 21:54:34 +0000 (14:54 -0700)
commit2e10671ec743c1ce5b237a6d8aff0c0c074a001d
tree34500465286437f546cdf0befb9afa2479e005d8
parent50f82e68470c3efbb8ceae8f8c8d289a079d7031
[RISCV] Improve detection of when to skip (and (srl x, c2) c1) -> (srli (slli x, c3-c2), c3) isel.

We have a special case to skip this transform if c1 is 0xffffffff
and x is sext_inreg in order to use sraiw+zext.w. But we were only
checking that we have a sext_inreg opcode, not how many bits are
being sign extended.

This commit adds a check that it is a sext_inreg from i32 so we know for
sure that an sraiw can be created.
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/test/CodeGen/RISCV/rv64zba.ll