Skip to content

Commit 90ec039

Browse files
committed
[AArch64] Ensure the type of LDNP/STNP is always v2i64
I think this is OK, that we always use v2i64 for the type of a LDNP/STNP nodes. Bitcasting the type should be fine for little endian. This helps with llvm#150125
1 parent 5bbf01f commit 90ec039

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6813,7 +6813,8 @@ SDValue AArch64TargetLowering::LowerSTORE(SDValue Op,
68136813
DAG.getConstant(EC.getKnownMinValue() / 2, Dl, MVT::i64));
68146814
SDValue Result = DAG.getMemIntrinsicNode(
68156815
AArch64ISD::STNP, Dl, DAG.getVTList(MVT::Other),
6816-
{StoreNode->getChain(), Lo, Hi, StoreNode->getBasePtr()},
6816+
{StoreNode->getChain(), DAG.getBitcast(MVT::v2i64, Lo),
6817+
DAG.getBitcast(MVT::v2i64, Hi), StoreNode->getBasePtr()},
68176818
StoreNode->getMemoryVT(), StoreNode->getMemOperand());
68186819
return Result;
68196820
}
@@ -27907,16 +27908,16 @@ void AArch64TargetLowering::ReplaceNodeResults(
2790727908
MemVT.getScalarSizeInBits() == 32u ||
2790827909
MemVT.getScalarSizeInBits() == 64u)) {
2790927910

27911+
EVT HalfVT = MemVT.getHalfNumVectorElementsVT(*DAG.getContext());
2791027912
SDValue Result = DAG.getMemIntrinsicNode(
2791127913
AArch64ISD::LDNP, SDLoc(N),
27912-
DAG.getVTList({MemVT.getHalfNumVectorElementsVT(*DAG.getContext()),
27913-
MemVT.getHalfNumVectorElementsVT(*DAG.getContext()),
27914-
MVT::Other}),
27914+
DAG.getVTList({MVT::v2i64, MVT::v2i64, MVT::Other}),
2791527915
{LoadNode->getChain(), LoadNode->getBasePtr()},
2791627916
LoadNode->getMemoryVT(), LoadNode->getMemOperand());
2791727917

2791827918
SDValue Pair = DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(N), MemVT,
27919-
Result.getValue(0), Result.getValue(1));
27919+
DAG.getBitcast(HalfVT, Result.getValue(0)),
27920+
DAG.getBitcast(HalfVT, Result.getValue(1)));
2792027921
Results.append({Pair, Result.getValue(2) /* Chain */});
2792127922
return;
2792227923
}

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,10 @@ def SDT_AArch64uaddlp : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>]>;
518518

519519
def SDT_AArch64ldp : SDTypeProfile<2, 1, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
520520
def SDT_AArch64ldiapp : SDTypeProfile<2, 1, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
521-
def SDT_AArch64ldnp : SDTypeProfile<2, 1, [SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
521+
def SDT_AArch64ldnp : SDTypeProfile<2, 1, [SDTCisVT<0, v2i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
522522
def SDT_AArch64stp : SDTypeProfile<0, 3, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
523523
def SDT_AArch64stilp : SDTypeProfile<0, 3, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
524-
def SDT_AArch64stnp : SDTypeProfile<0, 3, [SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
524+
def SDT_AArch64stnp : SDTypeProfile<0, 3, [SDTCisVT<0, v2i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>;
525525

526526
// Generates the general dynamic sequences, i.e.
527527
// adrp x0, :tlsdesc:var

0 commit comments

Comments
 (0)