Skip to content

Commit 34caafe

Browse files
[LLVM][CodeGen][AArch64] Simplify lowering for predicate inserts. (#89072)
The original code has an invalid use of UZP1 because the result vector type does not match its input vector types. Rather than insert extra nop casts I figure it would be better to use CONCAT_VECTORS because that's the operation we're performing. NOTE: This is a step to enable more asserts in verifyTargetSDNode.
1 parent f89f670 commit 34caafe

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13896,16 +13896,14 @@ SDValue AArch64TargetLowering::LowerINSERT_SUBVECTOR(SDValue Op,
1389613896
DAG.getVectorIdxConstant(0, DL));
1389713897
Hi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, HalfVT, Vec0,
1389813898
DAG.getVectorIdxConstant(NumElts / 2, DL));
13899-
if (Idx < (NumElts / 2)) {
13900-
SDValue NewLo = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Lo, Vec1,
13901-
DAG.getVectorIdxConstant(Idx, DL));
13902-
return DAG.getNode(AArch64ISD::UZP1, DL, VT, NewLo, Hi);
13903-
} else {
13904-
SDValue NewHi =
13905-
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Hi, Vec1,
13906-
DAG.getVectorIdxConstant(Idx - (NumElts / 2), DL));
13907-
return DAG.getNode(AArch64ISD::UZP1, DL, VT, Lo, NewHi);
13908-
}
13899+
if (Idx < (NumElts / 2))
13900+
Lo = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Lo, Vec1,
13901+
DAG.getVectorIdxConstant(Idx, DL));
13902+
else
13903+
Hi = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Hi, Vec1,
13904+
DAG.getVectorIdxConstant(Idx - (NumElts / 2), DL));
13905+
13906+
return DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, Lo, Hi);
1390913907
}
1391013908

1391113909
// Ensure the subvector is half the size of the main vector.

0 commit comments

Comments
 (0)