forked from OSchip/llvm-project
[RISCV] Remove special case for constant shift amount in FSHL/FSHR lowering to FSL/FSR.
Remove fshl/fshr with constant shift amount isel patterns. Replace with fsr/fsl with constant isel patterns. This hack was trying to preserve as much optimization opportunity for fshl/fshr by constant as possible, but the conversion to RISCVISD::FSR/FSL happens so late it probably isn't worth much. The new isel patterns are needed by D117468 anyway.
This commit is contained in:
parent
138cc5a001
commit
5a6c622afd
|
@ -2792,8 +2792,6 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
|
|||
MVT VT = Op.getSimpleValueType();
|
||||
assert(VT == Subtarget.getXLenVT() && "Unexpected custom legalization");
|
||||
SDLoc DL(Op);
|
||||
if (Op.getOperand(2).getOpcode() == ISD::Constant)
|
||||
return Op;
|
||||
// FSL/FSR take a log2(XLen)+1 bit shift amount but XLenVT FSHL/FSHR only
|
||||
// use log(XLen) bits. Mask the shift amount accordingly to prevent
|
||||
// accidentally setting the extra bit.
|
||||
|
|
|
@ -906,16 +906,11 @@ def : Pat<(riscv_fsl GPR:$rs1, GPR:$rs3, GPR:$rs2),
|
|||
(FSL GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
|
||||
def : Pat<(riscv_fsr GPR:$rs1, GPR:$rs3, GPR:$rs2),
|
||||
(FSR GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
|
||||
|
||||
// fshl and fshr concatenate their operands in the same order. fsr and fsl
|
||||
// instruction use different orders. fshl will return its first operand for
|
||||
// shift of zero, fshr will return its second operand. fsl and fsr both return
|
||||
// $rs1 so the patterns need to have different operand orders.
|
||||
def : Pat<(fshr GPR:$rs3, GPR:$rs1, uimmlog2xlen:$shamt),
|
||||
def : Pat<(riscv_fsr GPR:$rs1, GPR:$rs3, uimmlog2xlen:$shamt),
|
||||
(FSRI GPR:$rs1, GPR:$rs3, uimmlog2xlen:$shamt)>;
|
||||
// We can use FSRI for fshl by immediate if we subtract the immediate from
|
||||
// We can use FSRI for FSL by immediate if we subtract the immediate from
|
||||
// XLen and swap the operands.
|
||||
def : Pat<(fshl GPR:$rs3, GPR:$rs1, uimmlog2xlen:$shamt),
|
||||
def : Pat<(riscv_fsl GPR:$rs3, GPR:$rs1, uimmlog2xlen:$shamt),
|
||||
(FSRI GPR:$rs1, GPR:$rs3, (ImmSubFromXLen uimmlog2xlen:$shamt))>;
|
||||
} // Predicates = [HasStdExtZbt]
|
||||
|
||||
|
|
Loading…
Reference in New Issue