Skip to content

Commit 82d5f95

Browse files
[fixup] Rebase, update tests, add SVEAllActive patterns, add tests for the new all-true patterns, change undef to poison
1 parent 589d573 commit 82d5f95

File tree

2 files changed

+496
-34
lines changed

2 files changed

+496
-34
lines changed

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,16 @@ multiclass SVE_InReg_Extend_PassthruUndef<ValueType vt, SDPatternOperator op, Va
662662
(inst $PassThru, $Pg, $Src)>;
663663
}
664664

665-
class SVE_InReg_Extend_PassthruUndefZero<ValueType vt, SDPatternOperator op, ValueType pt,
666-
ValueType inreg_vt, Instruction inst>
667-
: Pat<(vt (op pt:$Pg, vt:$Src, inreg_vt, (vt (SVEDup0Undef)))),
668-
(inst $Pg, $Src)>;
665+
multiclass SVE_InReg_Extend_PassthruUndefZero<ValueType vt, SDPatternOperator op, ValueType pt,
666+
ValueType inreg_vt, Instruction inst> {
667+
let AddedComplexity = 1 in {
668+
def : Pat<(vt (op pt:$Pg, vt:$Src, inreg_vt, (vt (SVEDup0Undef)))),
669+
(inst $Pg, $Src)>;
670+
671+
def : Pat<(vt (op (pt (SVEAllActive:$Pg)), vt:$Src, inreg_vt, (vt (SVEAny)))),
672+
(inst $Pg, $Src)>;
673+
}
674+
}
669675

670676
class SVE_Shift_DupImm_Pred_Pat<ValueType vt, SDPatternOperator op,
671677
ValueType pt, ValueType it,
@@ -4957,9 +4963,9 @@ multiclass sve_int_un_pred_arit_h_z<bits<3> opc, string asm, SDPatternOperator o
49574963
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49584964
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
49594965

4960-
def : SVE_InReg_Extend_PassthruUndefZero<nxv8i16, op, nxv8i1, nxv8i8, !cast<Instruction>(NAME # _H)>;
4961-
def : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i8, !cast<Instruction>(NAME # _S)>;
4962-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i8, !cast<Instruction>(NAME # _D)>;
4966+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv8i16, op, nxv8i1, nxv8i8, !cast<Instruction>(NAME # _H)>;
4967+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i8, !cast<Instruction>(NAME # _S)>;
4968+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i8, !cast<Instruction>(NAME # _D)>;
49634969
}
49644970

49654971
multiclass sve_int_un_pred_arit_w<bits<3> opc, string asm,
@@ -4983,8 +4989,8 @@ multiclass sve_int_un_pred_arit_w_z<bits<3> opc, string asm, SDPatternOperator o
49834989
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49844990
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
49854991

4986-
def : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i16, !cast<Instruction>(NAME # _S)>;
4987-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i16, !cast<Instruction>(NAME # _D)>;
4992+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i16, !cast<Instruction>(NAME # _S)>;
4993+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i16, !cast<Instruction>(NAME # _D)>;
49884994
}
49894995

49904996
multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
@@ -5002,7 +5008,7 @@ multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
50025008
multiclass sve_int_un_pred_arit_d_z<bits<3> opc, string asm, SDPatternOperator op> {
50035009
def _D : sve_int_un_pred_arit_z<0b11, {opc, 0b0}, asm, ZPR64>;
50045010

5005-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i32, !cast<Instruction>(NAME # _D)>;
5011+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i32, !cast<Instruction>(NAME # _D)>;
50065012
}
50075013

50085014
multiclass sve_int_un_pred_arit_bitwise<bits<3> opc, string asm,

0 commit comments

Comments
 (0)