[RISCV] Remove sext_inreg+add/sub/mul/shl isel patterns.
authorCraig Topper <craig.topper@sifive.com>
Wed, 18 Aug 2021 17:46:09 +0000 (10:46 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 18 Aug 2021 18:07:11 +0000 (11:07 -0700)
commit3f9b37ccb15aec02832ab363649fc7959864ec23
tree29ea9cc683b8c898f4969df3529b47c35eb181b4
parent791006fb8c6fff4f33c33cb513a96b1d3f94c767
[RISCV] Remove sext_inreg+add/sub/mul/shl isel patterns.

Let the sext_inreg be selected to sext.w. Remove unneeded sext.w
during PostProcessISelDAG.

This gives opportunities for some other isel patterns to match
like the ADDIPair or matching mul with immediate to shXadd.

This becomes possible after D107658 started selecting W instructions
based on users. The sext.w will be considered a W user so isel
will often select a W instruction for the sext.w input and we can
just remove the sext.w. Otherwise we can combine the sext.w with
a ADD/SUB/MUL/SLLI to create a new W instruction in parallel
to the the original instruction.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D107708
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/lib/Target/RISCV/RISCVInstrInfoM.td
llvm/test/CodeGen/RISCV/add-imm.ll
llvm/test/CodeGen/RISCV/rv64zba.ll
llvm/test/CodeGen/RISCV/xaluo.ll