Skip to content

Commit 702b903

Browse files
[LLVM][CodeGen][AArch64] Lower vector-(de)interleave to multi-register uzp/zip instructions. (#143128)
1 parent 7ef77eb commit 702b903

File tree

3 files changed

+850
-392
lines changed

3 files changed

+850
-392
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29451,6 +29451,30 @@ AArch64TargetLowering::LowerVECTOR_DEINTERLEAVE(SDValue Op,
2945129451
assert(OpVT.isScalableVector() &&
2945229452
"Expected scalable vector in LowerVECTOR_DEINTERLEAVE.");
2945329453

29454+
// Are multi-register uzp instructions available?
29455+
if (Subtarget->hasSME2() && Subtarget->isStreaming() &&
29456+
OpVT.getVectorElementType() != MVT::i1) {
29457+
Intrinsic::ID IntID;
29458+
switch (Op->getNumOperands()) {
29459+
default:
29460+
return SDValue();
29461+
case 2:
29462+
IntID = Intrinsic::aarch64_sve_uzp_x2;
29463+
break;
29464+
case 4:
29465+
if (Subtarget->getMinSVEVectorSizeInBits() < 256 &&
29466+
OpVT.getScalarSizeInBits() == 64)
29467+
return SDValue();
29468+
IntID = Intrinsic::aarch64_sve_uzp_x4;
29469+
break;
29470+
}
29471+
29472+
SmallVector<SDValue, 5> Ops;
29473+
Ops.push_back(DAG.getTargetConstant(IntID, DL, MVT::i64));
29474+
Ops.append(Op->op_values().begin(), Op->op_values().end());
29475+
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, Op->getVTList(), Ops);
29476+
}
29477+
2945429478
if (Op->getNumOperands() != 2)
2945529479
return SDValue();
2945629480

@@ -29468,6 +29492,30 @@ SDValue AArch64TargetLowering::LowerVECTOR_INTERLEAVE(SDValue Op,
2946829492
assert(OpVT.isScalableVector() &&
2946929493
"Expected scalable vector in LowerVECTOR_INTERLEAVE.");
2947029494

29495+
// Are multi-register zip instructions available?
29496+
if (Subtarget->hasSME2() && Subtarget->isStreaming() &&
29497+
OpVT.getVectorElementType() != MVT::i1) {
29498+
Intrinsic::ID IntID;
29499+
switch (Op->getNumOperands()) {
29500+
default:
29501+
return SDValue();
29502+
case 2:
29503+
IntID = Intrinsic::aarch64_sve_zip_x2;
29504+
break;
29505+
case 4:
29506+
if (Subtarget->getMinSVEVectorSizeInBits() < 256 &&
29507+
OpVT.getScalarSizeInBits() == 64)
29508+
return SDValue();
29509+
IntID = Intrinsic::aarch64_sve_zip_x4;
29510+
break;
29511+
}
29512+
29513+
SmallVector<SDValue, 5> Ops;
29514+
Ops.push_back(DAG.getTargetConstant(IntID, DL, MVT::i64));
29515+
Ops.append(Op->op_values().begin(), Op->op_values().end());
29516+
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, Op->getVTList(), Ops);
29517+
}
29518+
2947129519
if (Op->getNumOperands() != 2)
2947229520
return SDValue();
2947329521

0 commit comments

Comments
 (0)