Skip to content

Commit dd8153b

Browse files
committed
[ARM][MVE] Tail predicate VML[A|S]LDAV
Make the non-exchanging versions of the multiply add/sub instructions validForTailPredication. Differential Revision: https://reviews.llvm.org/D77648
1 parent 7bb9f50 commit dd8153b

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

llvm/lib/Target/ARM/ARMInstrMVE.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,11 @@ class MVE_VMLAMLSDAV<string iname, string suffix, dag iops, string cstr,
909909
let Inst{3-1} = Qm{2-0};
910910
let Inst{0} = bit_0;
911911
let horizontalReduction = 1;
912+
// Allow tail predication for non-exchanging versions. As this is also a
913+
// horizontalReduction, ARMLowOverheadLoops will also have to check that
914+
// the vector operands contain zeros in their false lanes for the instruction
915+
// to be properly valid.
916+
let validForTailPredication = !eq(X, 0);
912917
}
913918

914919
multiclass MVE_VMLAMLSDAV_A<string iname, string x, MVEVectorVTInfo VTI,
@@ -1068,6 +1073,11 @@ class MVE_VMLALDAVBase<string iname, string suffix, dag iops, string cstr,
10681073
let Inst{3-1} = Qm{2-0};
10691074
let Inst{0} = bit_0;
10701075
let horizontalReduction = 1;
1076+
// Allow tail predication for non-exchanging versions. As this is also a
1077+
// horizontalReduction, ARMLowOverheadLoops will also have to check that
1078+
// the vector operands contain zeros in their false lanes for the instruction
1079+
// to be properly valid.
1080+
let validForTailPredication = !eq(X, 0);
10711081

10721082
let hasSideEffects = 0;
10731083
}

llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ namespace ARMII {
393393
// in an IT block).
394394
ThumbArithFlagSetting = 1 << 19,
395395

396-
// Whether an instruction can be included in an MVE tail-predicated loop.
396+
// Whether an instruction can be included in an MVE tail-predicated loop,
397+
// though extra validity checks may need to be performed too.
397398
ValidForTailPredication = 1 << 20,
398399

399400
// Whether an instruction writes to the top/bottom half of a vector element

llvm/unittests/Target/ARM/MachineInstrTest.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ TEST(MachineInstructionRetainsPreviousHalfElement, IsCorrect) {
368368
// descriptions. Currently we, conservatively, disallow:
369369
// - cross beat carries.
370370
// - complex operations.
371-
// - horizontal operations.
371+
// - horizontal operations with exchange.
372372
// - byte swapping.
373373
// - interleaved memory instructions.
374374
// TODO: Add to this list once we can handle them safely.
@@ -531,6 +531,42 @@ TEST(MachineInstrValidTailPredication, IsCorrect) {
531531
case MVE_VMINu16:
532532
case MVE_VMINu32:
533533
case MVE_VMINu8:
534+
case MVE_VMLADAVas16:
535+
case MVE_VMLADAVas32:
536+
case MVE_VMLADAVas8:
537+
case MVE_VMLADAVau16:
538+
case MVE_VMLADAVau32:
539+
case MVE_VMLADAVau8:
540+
case MVE_VMLADAVs16:
541+
case MVE_VMLADAVs32:
542+
case MVE_VMLADAVs8:
543+
case MVE_VMLADAVu16:
544+
case MVE_VMLADAVu32:
545+
case MVE_VMLADAVu8:
546+
case MVE_VMLALDAVs16:
547+
case MVE_VMLALDAVs32:
548+
case MVE_VMLALDAVu16:
549+
case MVE_VMLALDAVu32:
550+
case MVE_VMLALDAVas16:
551+
case MVE_VMLALDAVas32:
552+
case MVE_VMLALDAVau16:
553+
case MVE_VMLALDAVau32:
554+
case MVE_VMLSDAVas16:
555+
case MVE_VMLSDAVas32:
556+
case MVE_VMLSDAVas8:
557+
case MVE_VMLSDAVs16:
558+
case MVE_VMLSDAVs32:
559+
case MVE_VMLSDAVs8:
560+
case MVE_VMLSLDAVas16:
561+
case MVE_VMLSLDAVas32:
562+
case MVE_VMLSLDAVs16:
563+
case MVE_VMLSLDAVs32:
564+
case MVE_VRMLALDAVHas32:
565+
case MVE_VRMLALDAVHau32:
566+
case MVE_VRMLALDAVHs32:
567+
case MVE_VRMLALDAVHu32:
568+
case MVE_VRMLSLDAVHas32:
569+
case MVE_VRMLSLDAVHs32:
534570
case MVE_VMLAS_qr_s16:
535571
case MVE_VMLAS_qr_s32:
536572
case MVE_VMLAS_qr_s8:

0 commit comments

Comments
 (0)