File tree Expand file tree Collapse file tree 2 files changed +198
-88
lines changed
test/Transforms/LoopVectorize/AArch64 Expand file tree Collapse file tree 2 files changed +198
-88
lines changed Original file line number Diff line number Diff line change @@ -4682,13 +4682,24 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
4682
4682
EVT InputEVT = EVT::getEVT (InputTypeA);
4683
4683
EVT AccumEVT = EVT::getEVT (AccumType);
4684
4684
4685
- if (VF.isScalable () && !ST->isSVEorStreamingSVEAvailable ())
4686
- return Invalid;
4685
+ unsigned VFMinValue = VF.getKnownMinValue ();
4686
+
4687
+ if (VF.isScalable ()) {
4688
+ if (!ST->isSVEorStreamingSVEAvailable ())
4689
+ return Invalid;
4690
+
4691
+ // Don't accept a partial reduction if the scaled accumulator is vscale x 1,
4692
+ // since we can't lower that type.
4693
+ unsigned Scale =
4694
+ AccumEVT.getScalarSizeInBits () / InputEVT.getScalarSizeInBits ();
4695
+ if (VFMinValue == Scale)
4696
+ return Invalid;
4697
+ }
4687
4698
if (VF.isFixed () && (!ST->isNeonAvailable () || !ST->hasDotProd ()))
4688
4699
return Invalid;
4689
4700
4690
4701
if (InputEVT == MVT::i8 ) {
4691
- switch (VF. getKnownMinValue () ) {
4702
+ switch (VFMinValue ) {
4692
4703
default :
4693
4704
return Invalid;
4694
4705
case 8 :
@@ -4707,7 +4718,7 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
4707
4718
} else if (InputEVT == MVT::i16 ) {
4708
4719
// FIXME: Allow i32 accumulator but increase cost, as we would extend
4709
4720
// it to i64.
4710
- if (VF. getKnownMinValue () != 8 || AccumEVT != MVT::i64 )
4721
+ if (VFMinValue != 8 || AccumEVT != MVT::i64 )
4711
4722
return Invalid;
4712
4723
} else
4713
4724
return Invalid;
You can’t perform that action at this time.
0 commit comments