Skip to content

Commit

Permalink
[RISCV] Use getTargetExtractSubreg and getTargetInsertSubreg to simpl…
Browse files Browse the repository at this point in the history
…ify some code. NFCI
  • Loading branch information
topperc committed Mar 17, 2021
1 parent a233d72 commit 92b39c6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,8 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
return ReplaceNode(Node, NewNode);
}

SDNode *NewNode = CurDAG->getMachineNode(
TargetOpcode::INSERT_SUBREG, DL, VT, V, SubV,
CurDAG->getTargetConstant(SubRegIdx, DL, XLenVT));
return ReplaceNode(Node, NewNode);
SDValue Insert = CurDAG->getTargetInsertSubreg(SubRegIdx, DL, VT, V, SubV);
return ReplaceNode(Node, Insert.getNode());
}
case ISD::EXTRACT_SUBVECTOR: {
SDValue V = Node->getOperand(0);
Expand Down Expand Up @@ -1033,10 +1031,8 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
return ReplaceNode(Node, NewNode);
}

SDNode *NewNode = CurDAG->getMachineNode(
TargetOpcode::EXTRACT_SUBREG, DL, VT, V,
CurDAG->getTargetConstant(SubRegIdx, DL, XLenVT));
return ReplaceNode(Node, NewNode);
SDValue Extract = CurDAG->getTargetExtractSubreg(SubRegIdx, DL, VT, V);
return ReplaceNode(Node, Extract.getNode());
}
}

Expand Down

0 comments on commit 92b39c6

Please sign in to comment.