[RISCV] Move GORCIW/GREVIW formation to isel patterns.
authorCraig Topper <craig.topper@sifive.com>
Sat, 12 Mar 2022 01:10:03 +0000 (17:10 -0800)
committerCraig Topper <craig.topper@sifive.com>
Sat, 12 Mar 2022 02:02:47 +0000 (18:02 -0800)
commit43f668b98e8d87290fc6bbf5ed13c3ab542e3497
tree1cc9b7b45d53bb99d85024b5e9436313dbfb6a53
parentfa62c5326a9d74a52ed0678db470a3d759f1602a
[RISCV] Move GORCIW/GREVIW formation to isel patterns.

Type legalize narrow RISCVISD::GREV/GORC with constant to a larger
type without switching to W. Detect sext_inreg+gorci/grevi with a
uimm5 immediate during isel to emit GREVIW/GORCIW.

This allows us to better propagate known bits information through
extended bits after type legalization. It will also simplify a
change I'm considering for BREV8 with Zbkb.

A future patch will add computeKnownBits support for GORC.

A further improvement here would be to use hasAllWUsers and
doPeepholeSExtW like we do for SLLIW, but I don't think we have
the test coverage for that yet.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
llvm/test/CodeGen/RISCV/rv64zbb-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zbp-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zbp.ll