Skip to content

Commit 38353aa

Browse files
[fixup] Rebase, update tests, add SVEAllActive patterns, add tests for the new all-true patterns, change undef to poison
1 parent 3562867 commit 38353aa

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,
@@ -4909,9 +4915,9 @@ multiclass sve_int_un_pred_arit_h_z<bits<3> opc, string asm, SDPatternOperator o
49094915
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49104916
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
49114917

4912-
def : SVE_InReg_Extend_PassthruUndefZero<nxv8i16, op, nxv8i1, nxv8i8, !cast<Instruction>(NAME # _H)>;
4913-
def : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i8, !cast<Instruction>(NAME # _S)>;
4914-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i8, !cast<Instruction>(NAME # _D)>;
4918+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv8i16, op, nxv8i1, nxv8i8, !cast<Instruction>(NAME # _H)>;
4919+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i8, !cast<Instruction>(NAME # _S)>;
4920+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i8, !cast<Instruction>(NAME # _D)>;
49154921
}
49164922

49174923
multiclass sve_int_un_pred_arit_w<bits<3> opc, string asm,
@@ -4935,8 +4941,8 @@ multiclass sve_int_un_pred_arit_w_z<bits<3> opc, string asm, SDPatternOperator o
49354941
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49364942
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
49374943

4938-
def : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i16, !cast<Instruction>(NAME # _S)>;
4939-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i16, !cast<Instruction>(NAME # _D)>;
4944+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv4i32, op, nxv4i1, nxv4i16, !cast<Instruction>(NAME # _S)>;
4945+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i16, !cast<Instruction>(NAME # _D)>;
49404946
}
49414947

49424948
multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
@@ -4954,7 +4960,7 @@ multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
49544960
multiclass sve_int_un_pred_arit_d_z<bits<3> opc, string asm, SDPatternOperator op> {
49554961
def _D : sve_int_un_pred_arit_z<0b11, {opc, 0b0}, asm, ZPR64>;
49564962

4957-
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i32, !cast<Instruction>(NAME # _D)>;
4963+
defm : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i32, !cast<Instruction>(NAME # _D)>;
49584964
}
49594965

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

0 commit comments

Comments
 (0)