@@ -360,24 +360,24 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
360
360
if (Subtarget->hasNEON()) {
361
361
addRegisterClass(MVT::v16i8, &AArch64::FPR8RegClass);
362
362
addRegisterClass(MVT::v8i16, &AArch64::FPR16RegClass);
363
- // Someone set us up the NEON.
364
- addDRTypeForNEON (MVT::v2f32);
365
- addDRTypeForNEON (MVT::v8i8);
366
- addDRTypeForNEON (MVT::v4i16);
367
- addDRTypeForNEON (MVT::v2i32);
368
- addDRTypeForNEON (MVT::v1i64);
369
- addDRTypeForNEON (MVT::v1f64);
370
- addDRTypeForNEON (MVT::v4f16);
371
- addDRTypeForNEON (MVT::v4bf16);
372
-
373
- addQRTypeForNEON (MVT::v4f32);
374
- addQRTypeForNEON (MVT::v2f64);
375
- addQRTypeForNEON (MVT::v16i8);
376
- addQRTypeForNEON (MVT::v8i16);
377
- addQRTypeForNEON (MVT::v4i32);
378
- addQRTypeForNEON (MVT::v2i64);
379
- addQRTypeForNEON (MVT::v8f16);
380
- addQRTypeForNEON (MVT::v8bf16);
363
+
364
+ addDRType (MVT::v2f32);
365
+ addDRType (MVT::v8i8);
366
+ addDRType (MVT::v4i16);
367
+ addDRType (MVT::v2i32);
368
+ addDRType (MVT::v1i64);
369
+ addDRType (MVT::v1f64);
370
+ addDRType (MVT::v4f16);
371
+ addDRType (MVT::v4bf16);
372
+
373
+ addQRType (MVT::v4f32);
374
+ addQRType (MVT::v2f64);
375
+ addQRType (MVT::v16i8);
376
+ addQRType (MVT::v8i16);
377
+ addQRType (MVT::v4i32);
378
+ addQRType (MVT::v2i64);
379
+ addQRType (MVT::v8f16);
380
+ addQRType (MVT::v8bf16);
381
381
}
382
382
383
383
if (Subtarget->hasSVEorSME()) {
@@ -1125,7 +1125,7 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1125
1125
1126
1126
setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
1127
1127
1128
- if (Subtarget->hasNEON ()) {
1128
+ if (Subtarget->isNeonAvailable ()) {
1129
1129
// FIXME: v1f64 shouldn't be legal if we can avoid it, because it leads to
1130
1130
// silliness like this:
1131
1131
for (auto Op :
@@ -1337,6 +1337,24 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1337
1337
// FADDP custom lowering
1338
1338
for (MVT VT : { MVT::v16f16, MVT::v8f32, MVT::v4f64 })
1339
1339
setOperationAction(ISD::FADD, VT, Custom);
1340
+ } else /* !isNeonAvailable */ {
1341
+ for (MVT VT : MVT::fixedlen_vector_valuetypes()) {
1342
+ for (unsigned Op = 0; Op < ISD::BUILTIN_OP_END; ++Op)
1343
+ setOperationAction(Op, VT, Expand);
1344
+
1345
+ if (VT.is128BitVector() || VT.is64BitVector()) {
1346
+ setOperationAction(ISD::LOAD, VT, Legal);
1347
+ setOperationAction(ISD::STORE, VT, Legal);
1348
+ setOperationAction(ISD::BITCAST, VT,
1349
+ Subtarget->isLittleEndian() ? Legal : Expand);
1350
+ }
1351
+ for (MVT InnerVT : MVT::fixedlen_vector_valuetypes()) {
1352
+ setTruncStoreAction(VT, InnerVT, Expand);
1353
+ setLoadExtAction(ISD::SEXTLOAD, VT, InnerVT, Expand);
1354
+ setLoadExtAction(ISD::ZEXTLOAD, VT, InnerVT, Expand);
1355
+ setLoadExtAction(ISD::EXTLOAD, VT, InnerVT, Expand);
1356
+ }
1357
+ }
1340
1358
}
1341
1359
1342
1360
if (Subtarget->hasSME()) {
@@ -2020,14 +2038,16 @@ void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
2020
2038
setOperationAction(ISD::ZERO_EXTEND, VT, Default);
2021
2039
}
2022
2040
2023
- void AArch64TargetLowering::addDRTypeForNEON (MVT VT) {
2041
+ void AArch64TargetLowering::addDRType (MVT VT) {
2024
2042
addRegisterClass(VT, &AArch64::FPR64RegClass);
2025
- addTypeForNEON(VT);
2043
+ if (Subtarget->isNeonAvailable())
2044
+ addTypeForNEON(VT);
2026
2045
}
2027
2046
2028
- void AArch64TargetLowering::addQRTypeForNEON (MVT VT) {
2047
+ void AArch64TargetLowering::addQRType (MVT VT) {
2029
2048
addRegisterClass(VT, &AArch64::FPR128RegClass);
2030
- addTypeForNEON(VT);
2049
+ if (Subtarget->isNeonAvailable())
2050
+ addTypeForNEON(VT);
2031
2051
}
2032
2052
2033
2053
EVT AArch64TargetLowering::getSetCCResultType(const DataLayout &,
@@ -9445,7 +9465,8 @@ SDValue AArch64TargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) const {
9445
9465
9446
9466
SDValue AArch64TargetLowering::LowerFCOPYSIGN(SDValue Op,
9447
9467
SelectionDAG &DAG) const {
9448
- if (!Subtarget->hasNEON())
9468
+ if (!Subtarget->isNeonAvailable() &&
9469
+ !Subtarget->useSVEForFixedLengthVectors())
9449
9470
return SDValue();
9450
9471
9451
9472
EVT VT = Op.getValueType();
@@ -14141,6 +14162,13 @@ SDValue AArch64TargetLowering::LowerDIV(SDValue Op, SelectionDAG &DAG) const {
14141
14162
return DAG.getNode(AArch64ISD::UZP1, dl, VT, ResultLo, ResultHi);
14142
14163
}
14143
14164
14165
+ bool AArch64TargetLowering::shouldExpandBuildVectorWithShuffles(
14166
+ EVT VT, unsigned DefinedValues) const {
14167
+ if (!Subtarget->isNeonAvailable())
14168
+ return false;
14169
+ return TargetLowering::shouldExpandBuildVectorWithShuffles(VT, DefinedValues);
14170
+ }
14171
+
14144
14172
bool AArch64TargetLowering::isShuffleMaskLegal(ArrayRef<int> M, EVT VT) const {
14145
14173
// Currently no fixed length shuffles that require SVE are legal.
14146
14174
if (useSVEForFixedLengthVectorVT(VT, !Subtarget->isNeonAvailable()))
@@ -19838,7 +19866,8 @@ performSVEMulAddSubCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
19838
19866
// help, for example, to produce ssra from sshr+add.
19839
19867
static SDValue performAddSubIntoVectorOp(SDNode *N, SelectionDAG &DAG) {
19840
19868
EVT VT = N->getValueType(0);
19841
- if (VT != MVT::i64)
19869
+ if (VT != MVT::i64 ||
19870
+ DAG.getTargetLoweringInfo().isOperationExpand(N->getOpcode(), MVT::v1i64))
19842
19871
return SDValue();
19843
19872
SDValue Op0 = N->getOperand(0);
19844
19873
SDValue Op1 = N->getOperand(1);
0 commit comments