Skip to content

Commit 3c348bf

Browse files
authored
[RISCV] Fold (fmv_x_h/w (load)) to an integer load. (#109900)
1 parent 72307ba commit 3c348bf

File tree

6 files changed

+911
-1170
lines changed

6 files changed

+911
-1170
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16984,6 +16984,17 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1698416984
return Op0.getOperand(0);
1698516985
}
1698616986

16987+
if (ISD::isNormalLoad(Op0.getNode()) && Op0.hasOneUse() &&
16988+
cast<LoadSDNode>(Op0)->isSimple()) {
16989+
MVT IVT = MVT::getIntegerVT(Op0.getValueSizeInBits());
16990+
auto *LN0 = cast<LoadSDNode>(Op0);
16991+
SDValue Load =
16992+
DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT, LN0->getChain(),
16993+
LN0->getBasePtr(), IVT, LN0->getMemOperand());
16994+
DAG.ReplaceAllUsesOfValueWith(Op0.getValue(1), Load.getValue(1));
16995+
return Load;
16996+
}
16997+
1698716998
// This is a target-specific version of a DAGCombine performed in
1698816999
// DAGCombiner::visitBITCAST. It performs the equivalent of:
1698917000
// fold (bitconvert (fneg x)) -> (xor (bitconvert x), signbit)

0 commit comments

Comments
 (0)