Skip to content

Commit c702e0b

Browse files
committed
[ARM][AArch64] Use SelectionDAG::SplitScalar to simplify some code.
We know we're splitting a type in half to two legal values. Instead of using shift and truncate that need to be legalized, we can use two ISD::EXTRACT_ELEMENTs. Spotted while reviewing llvm#67918 for RISC-V which copied this code.
1 parent 98b4c1e commit c702e0b

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24301,10 +24301,7 @@ void AArch64TargetLowering::ReplaceExtractSubVectorResults(
2430124301
// Create an even/odd pair of X registers holding integer value V.
2430224302
static SDValue createGPRPairNode(SelectionDAG &DAG, SDValue V) {
2430324303
SDLoc dl(V.getNode());
24304-
SDValue VLo = DAG.getAnyExtOrTrunc(V, dl, MVT::i64);
24305-
SDValue VHi = DAG.getAnyExtOrTrunc(
24306-
DAG.getNode(ISD::SRL, dl, MVT::i128, V, DAG.getConstant(64, dl, MVT::i64)),
24307-
dl, MVT::i64);
24304+
auto [VLo, VHi] = DAG.SplitScalar(V, dl, MVT::i64, MVT::i64);
2430824305
if (DAG.getDataLayout().isBigEndian())
2430924306
std::swap (VLo, VHi);
2431024307
SDValue RegClass =

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10402,10 +10402,7 @@ static void ReplaceREADCYCLECOUNTER(SDNode *N,
1040210402

1040310403
static SDValue createGPRPairNode(SelectionDAG &DAG, SDValue V) {
1040410404
SDLoc dl(V.getNode());
10405-
SDValue VLo = DAG.getAnyExtOrTrunc(V, dl, MVT::i32);
10406-
SDValue VHi = DAG.getAnyExtOrTrunc(
10407-
DAG.getNode(ISD::SRL, dl, MVT::i64, V, DAG.getConstant(32, dl, MVT::i32)),
10408-
dl, MVT::i32);
10405+
auto [VLo, VHi] = DAG.SplitScalar(V, dl, MVT::i32, MVT::i32);
1040910406
bool isBigEndian = DAG.getDataLayout().isBigEndian();
1041010407
if (isBigEndian)
1041110408
std::swap (VLo, VHi);

0 commit comments

Comments
 (0)