Skip to content

Commit 55f9637

Browse files
[AArch64] Generate zeroing forms of certain SVE2.2 instructions (10/11)
1 parent 8554270 commit 55f9637

File tree

3 files changed

+1520
-8
lines changed

3 files changed

+1520
-8
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4336,11 +4336,11 @@ let Predicates = [HasSVE2p2orSME2p2] in {
43364336
defm LASTP_XPP : sve_int_pcount_pred_tmp<0b010, "lastp">;
43374337

43384338
// SVE reverse within elements, zeroing predicate
4339-
defm RBIT_ZPzZ : sve_int_perm_rev_rbit_z<"rbit">;
4340-
defm REVB_ZPzZ : sve_int_perm_rev_revb_z<"revb">;
4341-
defm REVH_ZPzZ : sve_int_perm_rev_revh_z<"revh">;
4342-
def REVW_ZPzZ : sve_int_perm_rev_z<0b11, 0b0110, "revw", ZPR64>;
4343-
def REVD_ZPzZ : sve_int_perm_rev_z<0b00, 0b1110, "revd", ZPR128>;
4339+
defm RBIT_ZPzZ : sve_int_perm_rev_rbit_z<"rbit", AArch64rbit_mt>;
4340+
defm REVB_ZPzZ : sve_int_perm_rev_revb_z<"revb", AArch64revb_mt>;
4341+
defm REVH_ZPzZ : sve_int_perm_rev_revh_z<"revh", AArch64revh_mt>;
4342+
defm REVW_ZPzZ : sve_int_perm_rev_revw_z<"revw", AArch64revw_mt>;
4343+
defm REVD_ZPzZ : sve_int_perm_rev_revd_z<"revd", AArch64revd_mt>;
43444344
} // End HasSME2p2orSVE2p2
43454345

43464346
//===----------------------------------------------------------------------===//

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7624,22 +7624,54 @@ class sve_int_perm_rev_z<bits<2> sz, bits<4> opc, string asm,
76247624
let hasSideEffects = 0;
76257625
}
76267626

7627-
multiclass sve_int_perm_rev_rbit_z<string asm> {
7627+
multiclass sve_int_perm_rev_rbit_z<string asm, SDPatternOperator op> {
76287628
def _B : sve_int_perm_rev_z<0b00, 0b0111, asm, ZPR8>;
76297629
def _H : sve_int_perm_rev_z<0b01, 0b0111, asm, ZPR16>;
76307630
def _S : sve_int_perm_rev_z<0b10, 0b0111, asm, ZPR32>;
76317631
def _D : sve_int_perm_rev_z<0b11, 0b0111, asm, ZPR64>;
7632+
7633+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv16i8, op, nxv16i1, nxv16i8, !cast<Instruction>(NAME # _B)>;
7634+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
7635+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
7636+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
76327637
}
76337638

7634-
multiclass sve_int_perm_rev_revb_z<string asm> {
7639+
multiclass sve_int_perm_rev_revb_z<string asm, SDPatternOperator op> {
76357640
def _H : sve_int_perm_rev_z<0b01, 0b0100, asm, ZPR16>;
76367641
def _S : sve_int_perm_rev_z<0b10, 0b0100, asm, ZPR32>;
76377642
def _D : sve_int_perm_rev_z<0b11, 0b0100, asm, ZPR64>;
7643+
7644+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
7645+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
7646+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
76387647
}
76397648

7640-
multiclass sve_int_perm_rev_revh_z<string asm> {
7649+
multiclass sve_int_perm_rev_revh_z<string asm, SDPatternOperator op> {
76417650
def _S : sve_int_perm_rev_z<0b10, 0b0101, asm, ZPR32>;
76427651
def _D : sve_int_perm_rev_z<0b11, 0b0101, asm, ZPR64>;
7652+
7653+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
7654+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
7655+
}
7656+
7657+
multiclass sve_int_perm_rev_revw_z<string asm, SDPatternOperator op> {
7658+
def _D : sve_int_perm_rev_z<0b11, 0b0110, asm, ZPR64>;
7659+
7660+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
7661+
}
7662+
7663+
multiclass sve_int_perm_rev_revd_z<string asm, SDPatternOperator op> {
7664+
def NAME : sve_int_perm_rev_z<0b00, 0b1110, asm, ZPR128>;
7665+
7666+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv16i8, op, nxv16i1, nxv16i8, !cast<Instruction>(NAME)>;
7667+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME)>;
7668+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME)>;
7669+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME)>;
7670+
7671+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, !cast<Instruction>(NAME)>;
7672+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv8f16, op, nxv8i1, nxv8f16, !cast<Instruction>(NAME)>;
7673+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv4f32, op, nxv4i1, nxv4f32, !cast<Instruction>(NAME)>;
7674+
def : SVE_1_Op_PassthruUndefZero_Pat<nxv2f64, op, nxv2i1, nxv2f64, !cast<Instruction>(NAME)>;
76437675
}
76447676

76457677
class sve_int_perm_cpy_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,

0 commit comments

Comments
 (0)