Skip to content

Commit c436649

Browse files
[AArch64] Remove all instances of the 'hasSVEorSME' interfaces. (#96543)
I've not added any new tests for these, because the original conditions were wrong (they did not consider streaming mode) and we have tests for the positive cases.
1 parent 952bdaa commit c436649

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4359,7 +4359,9 @@ bool AArch64DAGToDAGISel::trySelectXAR(SDNode *N) {
43594359
// N1 = SRL_PRED true, V, splat(imm) --> rotr amount
43604360
// N0 = SHL_PRED true, V, splat(bits-imm)
43614361
// V = (xor x, y)
4362-
if (VT.isScalableVector() && Subtarget->hasSVE2orSME()) {
4362+
if (VT.isScalableVector() &&
4363+
(Subtarget->hasSVE2() ||
4364+
(Subtarget->hasSME() && Subtarget->isStreaming()))) {
43634365
if (N0.getOpcode() != AArch64ISD::SHL_PRED ||
43644366
N1.getOpcode() != AArch64ISD::SRL_PRED)
43654367
std::swap(N0, N1);

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,8 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
14841484
if (!Subtarget->isLittleEndian())
14851485
setOperationAction(ISD::BITCAST, VT, Expand);
14861486

1487-
if (Subtarget->hasSVE2orSME())
1487+
if (Subtarget->hasSVE2() ||
1488+
(Subtarget->hasSME() && Subtarget->isStreaming()))
14881489
// For SLI/SRI.
14891490
setOperationAction(ISD::OR, VT, Custom);
14901491
}
@@ -1937,7 +1938,7 @@ bool AArch64TargetLowering::shouldExpandGetActiveLaneMask(EVT ResVT,
19371938
}
19381939

19391940
bool AArch64TargetLowering::shouldExpandCttzElements(EVT VT) const {
1940-
if (!Subtarget->hasSVEorSME())
1941+
if (!Subtarget->isSVEorStreamingSVEAvailable())
19411942
return true;
19421943

19431944
// We can only use the BRKB + CNTP sequence with legal predicate types. We can
@@ -14527,7 +14528,9 @@ SDValue AArch64TargetLowering::LowerVectorSRA_SRL_SHL(SDValue Op,
1452714528
Op.getOperand(0), Op.getOperand(1));
1452814529
case ISD::SRA:
1452914530
case ISD::SRL:
14530-
if (VT.isScalableVector() && Subtarget->hasSVE2orSME()) {
14531+
if (VT.isScalableVector() &&
14532+
(Subtarget->hasSVE2() ||
14533+
(Subtarget->hasSME() && Subtarget->isStreaming()))) {
1453114534
SDValue RShOperand;
1453214535
unsigned ShiftValue;
1453314536
if (canLowerSRLToRoundingShiftForVT(Op, VT, DAG, ShiftValue, RShOperand))
@@ -16234,15 +16237,13 @@ bool AArch64TargetLowering::isLegalInterleavedAccessType(
1623416237

1623516238
UseScalable = false;
1623616239

16237-
if (!VecTy->isScalableTy() && !Subtarget->isNeonAvailable() &&
16238-
!Subtarget->useSVEForFixedLengthVectors())
16239-
return false;
16240-
16241-
if (VecTy->isScalableTy() && !Subtarget->hasSVEorSME())
16240+
if (isa<FixedVectorType>(VecTy) && !Subtarget->isNeonAvailable() &&
16241+
(!Subtarget->useSVEForFixedLengthVectors() ||
16242+
!getSVEPredPatternFromNumElements(MinElts)))
1624216243
return false;
1624316244

16244-
// Ensure that the predicate for this number of elements is available.
16245-
if (Subtarget->hasSVE() && !getSVEPredPatternFromNumElements(MinElts))
16245+
if (isa<ScalableVectorType>(VecTy) &&
16246+
!Subtarget->isSVEorStreamingSVEAvailable())
1624616247
return false;
1624716248

1624816249
// Ensure the number of vector elements is greater than 1.

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4675,7 +4675,8 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
46754675

46764676
if (AArch64::FPR128RegClass.contains(DestReg) &&
46774677
AArch64::FPR128RegClass.contains(SrcReg)) {
4678-
if (Subtarget.hasSVEorSME() && !Subtarget.isNeonAvailable())
4678+
if (Subtarget.isSVEorStreamingSVEAvailable() &&
4679+
!Subtarget.isNeonAvailable())
46794680
BuildMI(MBB, I, DL, get(AArch64::ORR_ZZZ))
46804681
.addReg(AArch64::Z0 + (DestReg - AArch64::Q0), RegState::Define)
46814682
.addReg(AArch64::Z0 + (SrcReg - AArch64::Q0))

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,20 +361,17 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
361361

362362
void mirFileLoaded(MachineFunction &MF) const override;
363363

364-
bool hasSVEorSME() const { return hasSVE() || hasSME(); }
365-
bool hasSVE2orSME() const { return hasSVE2() || hasSME(); }
366-
367364
// Return the known range for the bit length of SVE data registers. A value
368365
// of 0 means nothing is known about that particular limit beyong what's
369366
// implied by the architecture.
370367
unsigned getMaxSVEVectorSizeInBits() const {
371-
assert(hasSVEorSME() &&
368+
assert(isSVEorStreamingSVEAvailable() &&
372369
"Tried to get SVE vector length without SVE support!");
373370
return MaxSVEVectorSizeInBits;
374371
}
375372

376373
unsigned getMinSVEVectorSizeInBits() const {
377-
assert(hasSVEorSME() &&
374+
assert(isSVEorStreamingSVEAvailable() &&
378375
"Tried to get SVE vector length without SVE support!");
379376
return MinSVEVectorSizeInBits;
380377
}

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,7 +2761,8 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
27612761
return AdjustCost(Entry->Cost);
27622762

27632763
if ((ISD == ISD::ZERO_EXTEND || ISD == ISD::SIGN_EXTEND) &&
2764-
CCH == TTI::CastContextHint::Masked && ST->hasSVEorSME() &&
2764+
CCH == TTI::CastContextHint::Masked &&
2765+
ST->isSVEorStreamingSVEAvailable() &&
27652766
TLI->getTypeAction(Src->getContext(), SrcTy) ==
27662767
TargetLowering::TypePromoteInteger &&
27672768
TLI->getTypeAction(Dst->getContext(), DstTy) ==
@@ -2782,8 +2783,8 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
27822783
// The BasicTTIImpl version only deals with CCH==TTI::CastContextHint::Normal,
27832784
// but we also want to include the TTI::CastContextHint::Masked case too.
27842785
if ((ISD == ISD::ZERO_EXTEND || ISD == ISD::SIGN_EXTEND) &&
2785-
CCH == TTI::CastContextHint::Masked && ST->hasSVEorSME() &&
2786-
TLI->isTypeLegal(DstTy))
2786+
CCH == TTI::CastContextHint::Masked &&
2787+
ST->isSVEorStreamingSVEAvailable() && TLI->isTypeLegal(DstTy))
27872788
CCH = TTI::CastContextHint::Normal;
27882789

27892790
return AdjustCost(

0 commit comments

Comments
 (0)