[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are...
authorCraig Topper <craig.topper@sifive.com>
Thu, 16 Sep 2021 17:37:55 +0000 (10:37 -0700)
committerCraig Topper <craig.topper@sifive.com>
Thu, 16 Sep 2021 18:03:35 +0000 (11:03 -0700)
commit73e5b9ea90ba857dd7f0f6b79dc39dfc90ad66ea
treec5376f70f5e87deb09f4c5b81349622175c78620
parentb4fa71eed34d967195514fe9b0a5211fca2bc5bc
[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used.

SimplifyDemandedBits can turn srl into sra if the bits being shifted
in aren't demanded. This patch can recover the original sra in some cases.

I've renamed the tablegen class for detecting W users since the "overflowing operator"
term I originally borrowed from Operator.h does not include srl.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D109162
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/lib/Target/RISCV/RISCVInstrInfoM.td
llvm/test/CodeGen/RISCV/rv64i-exhaustive-w-insts.ll
llvm/test/CodeGen/RISCV/srem-lkk.ll