Skip to content

Commit 589d573

Browse files
[AArch64] Generate zeroing forms of certain SVE2.2 instructions (11/11)
1 parent a876e35 commit 589d573

File tree

3 files changed

+598
-8
lines changed

3 files changed

+598
-8
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,14 +4325,14 @@ let Predicates = [HasSVE2p2orSME2p2] in {
43254325
defm FNEG_ZPzZ : sve_int_un_pred_arit_bitwise_fp_z<0b101, "fneg", AArch64fneg_mt>;
43264326

43274327
// SVE2p2 integer unary arithmetic, zeroing predicate
4328-
defm SXTB_ZPzZ : sve_int_un_pred_arit_h_z<0b000, "sxtb">;
4329-
defm UXTB_ZPzZ : sve_int_un_pred_arit_h_z<0b001, "uxtb">;
4330-
defm SXTH_ZPzZ : sve_int_un_pred_arit_w_z<0b010, "sxth">;
4331-
defm UXTH_ZPzZ : sve_int_un_pred_arit_w_z<0b011, "uxth">;
4328+
defm SXTB_ZPzZ : sve_int_un_pred_arit_h_z<0b000, "sxtb", AArch64sxt_mt>;
4329+
defm UXTB_ZPzZ : sve_int_un_pred_arit_h_z<0b001, "uxtb", AArch64uxt_mt>;
4330+
defm SXTH_ZPzZ : sve_int_un_pred_arit_w_z<0b010, "sxth", AArch64sxt_mt>;
4331+
defm UXTH_ZPzZ : sve_int_un_pred_arit_w_z<0b011, "uxth", AArch64uxt_mt>;
43324332
defm ABS_ZPzZ : sve_int_un_pred_arit_z< 0b110, "abs", AArch64abs_mt>;
43334333
defm NEG_ZPzZ : sve_int_un_pred_arit_z< 0b111, "neg", AArch64neg_mt>;
4334-
def SXTW_ZPzZ_D : sve_int_un_pred_arit_z<0b11, 0b1000, "sxtw", ZPR64>;
4335-
def UXTW_ZPzZ_D : sve_int_un_pred_arit_z<0b11, 0b1010, "uxtw", ZPR64>;
4334+
defm SXTW_ZPzZ : sve_int_un_pred_arit_d_z<0b100, "sxtw", AArch64sxt_mt>;
4335+
defm UXTW_ZPzZ : sve_int_un_pred_arit_d_z<0b101, "uxtw", AArch64uxt_mt>;
43364336

43374337
// SVE predicate count
43384338
defm FIRSTP_XPP : sve_int_pcount_pred_tmp<0b001, "firstp">;

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,11 @@ 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)>;
669+
665670
class SVE_Shift_DupImm_Pred_Pat<ValueType vt, SDPatternOperator op,
666671
ValueType pt, ValueType it,
667672
ComplexPattern cast, Instruction inst>
@@ -4947,10 +4952,14 @@ multiclass sve_int_un_pred_arit_h<bits<3> opc, string asm,
49474952
defm : SVE_InReg_Extend_PassthruUndef<nxv2i64, op, nxv2i1, nxv2i8, !cast<Pseudo>(NAME # _D_UNDEF)>;
49484953
}
49494954

4950-
multiclass sve_int_un_pred_arit_h_z<bits<3> opc, string asm> {
4955+
multiclass sve_int_un_pred_arit_h_z<bits<3> opc, string asm, SDPatternOperator op> {
49514956
def _H : sve_int_un_pred_arit_z<0b01, { opc, 0b0 }, asm, ZPR16>;
49524957
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49534958
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
4959+
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)>;
49544963
}
49554964

49564965
multiclass sve_int_un_pred_arit_w<bits<3> opc, string asm,
@@ -4970,9 +4979,12 @@ multiclass sve_int_un_pred_arit_w<bits<3> opc, string asm,
49704979
defm : SVE_InReg_Extend_PassthruUndef<nxv2i64, op, nxv2i1, nxv2i16, !cast<Pseudo>(NAME # _D_UNDEF)>;
49714980
}
49724981

4973-
multiclass sve_int_un_pred_arit_w_z<bits<3> opc, string asm> {
4982+
multiclass sve_int_un_pred_arit_w_z<bits<3> opc, string asm, SDPatternOperator op> {
49744983
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
49754984
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
4985+
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)>;
49764988
}
49774989

49784990
multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
@@ -4987,6 +4999,12 @@ multiclass sve_int_un_pred_arit_d<bits<3> opc, string asm,
49874999
defm : SVE_InReg_Extend_PassthruUndef<nxv2i64, op, nxv2i1, nxv2i32, !cast<Pseudo>(NAME # _D_UNDEF)>;
49885000
}
49895001

5002+
multiclass sve_int_un_pred_arit_d_z<bits<3> opc, string asm, SDPatternOperator op> {
5003+
def _D : sve_int_un_pred_arit_z<0b11, {opc, 0b0}, asm, ZPR64>;
5004+
5005+
def : SVE_InReg_Extend_PassthruUndefZero<nxv2i64, op, nxv2i1, nxv2i32, !cast<Instruction>(NAME # _D)>;
5006+
}
5007+
49905008
multiclass sve_int_un_pred_arit_bitwise<bits<3> opc, string asm,
49915009
SDPatternOperator op> {
49925010
def _B : sve_int_un_pred_arit<0b00, { opc, 0b1 }, asm, ZPR8>,

0 commit comments

Comments
 (0)