Skip to content
4 changes: 4 additions & 0 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ def HasSVE_B16MM : Predicate<"Subtarget->isSVEAvailable() && Subtarget->hasSV
AssemblerPredicateWithAll<(all_of FeatureSVE_B16MM), "sve-b16mm">;
def HasF16MM : Predicate<"Subtarget->isSVEAvailable() && Subtarget->hasF16MM()">,
AssemblerPredicateWithAll<(all_of FeatureF16MM), "f16mm">;
def HasSVE2p3 : Predicate<"Subtarget->hasSVE2p3()">,
AssemblerPredicateWithAll<(all_of FeatureSVE2p3), "sve2p3">;
def HasSME2p3 : Predicate<"Subtarget->hasSME2p3()">,
AssemblerPredicateWithAll<(all_of FeatureSME2p3), "sme2p3">;

// A subset of SVE(2) instructions are legal in Streaming SVE execution mode,
// they should be enabled if either has been specified.
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Target/AArch64/AArch64RegisterInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,10 @@ def Z_q : RegisterOperand<ZPR, "printTypedVectorList<0,'q'>"> {
let ParserMatchClass = ZPRVectorList<128, 1>;
}

def ZZ_Any : RegisterOperand<ZPR2, "printTypedVectorList<0,0>"> {
let ParserMatchClass = ZPRVectorList<0, 2>;
}

def ZZ_b : RegisterOperand<ZPR2, "printTypedVectorList<0,'b'>"> {
let ParserMatchClass = ZPRVectorList<8, 2>;
}
Expand All @@ -1361,6 +1365,10 @@ def ZZ_q : RegisterOperand<ZPR2, "printTypedVectorList<0,'q'>"> {
let ParserMatchClass = ZPRVectorList<128, 2>;
}

def ZZZ_Any : RegisterOperand<ZPR3, "printTypedVectorList<0,0>"> {
let ParserMatchClass = ZPRVectorList<0, 3>;
}

def ZZZ_b : RegisterOperand<ZPR3, "printTypedVectorList<0,'b'>"> {
let ParserMatchClass = ZPRVectorList<8, 3>;
}
Expand Down
11 changes: 11 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -1173,3 +1173,14 @@ let Predicates = [HasSME_MOP4, HasSMEF64F64] in {
defm FMOP4A : sme2_fmop4as_fp64_non_widening<0, "fmop4a", "int_aarch64_sme_mop4a">;
defm FMOP4S : sme2_fmop4as_fp64_non_widening<1, "fmop4s", "int_aarch64_sme_mop4s">;
}

//===----------------------------------------------------------------------===//
// SME2.3 instructions
//===----------------------------------------------------------------------===//
let Predicates = [HasSME2p3] in {
def LUTI6_ZTZ : sme2_lut_single<"luti6">;
def LUTI6_4ZT3Z : sme2_luti6_zt_consecutive<"luti6">;
def LUTI6_S_4ZT3Z : sme2_luti6_zt_strided<"luti6">;
def LUTI6_4Z2Z2ZI : sme2_luti6_vector_vg4_consecutive<"luti6">;
def LUTI6_S_4Z2Z2ZI : sme2_luti6_vector_vg4_strided<"luti6">;
} // [HasSME2p3]
9 changes: 9 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -4659,8 +4659,17 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
defm SQSHRUN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrun", 0b100, null_frag>;
defm SQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrn", 0b000, null_frag>;
defm UQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"uqshrn", 0b010, null_frag>;

defm LUTI6_Z2ZZI : sve2_luti6_vector_index<"luti6">;
} // End HasSME2p3orSVE2p3

//===----------------------------------------------------------------------===//
// SVE2.3 instructions
//===----------------------------------------------------------------------===//
let Predicates = [HasSVE2p3] in {
def LUTI6_Z2ZZ : sve2_luti6_vector<"luti6">;
}

//===----------------------------------------------------------------------===//
// SVE_B16MM Instructions
//===----------------------------------------------------------------------===//
Expand Down
7 changes: 7 additions & 0 deletions llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4882,6 +4882,13 @@ ParseStatus AArch64AsmParser::tryParseVectorList(OperandVector &Operands,
FirstReg, Count, Stride, NumElements, ElementWidth, VectorKind, S,
getLoc(), getContext()));

if (getTok().is(AsmToken::LBrac)) {
ParseStatus Res = tryParseVectorIndex(Operands);
if (Res.isFailure())
return ParseStatus::Failure;
return ParseStatus::Success;
}

return ParseStatus::Success;
}

Expand Down
72 changes: 72 additions & 0 deletions llvm/lib/Target/AArch64/SMEInstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -3920,6 +3920,78 @@ multiclass sme2_luti4_vector_vg4_index<string mnemonic> {
def _S : sme2_luti4_vector_vg4_index<0b10, ZZZZ_s_mul_r, mnemonic>;
}

// 8-bit Look up table
class sme2_lut_single<string asm>
: I<(outs ZPR8:$Zd), (ins ZTR:$ZTt, ZPRAny:$Zn),
asm, "\t$Zd, $ZTt, $Zn", "", []>, Sched<[]> {
bits<0> ZTt;
bits<5> Zd;
bits<5> Zn;
let Inst{31-10} = 0b1100000011001000010000;
let Inst{9-5} = Zn;
let Inst{4-0} = Zd;
}

//===----------------------------------------------------------------------===//
// Lookup table read with 6-bit indices (8-bit)
class sme2_luti6_zt_base<RegisterOperand zd_ty, string asm>
: I<(outs zd_ty:$Zd), (ins ZTR:$ZTt, ZZZ_Any:$Zn),
asm, "\t$Zd, $ZTt, $Zn", "", []>, Sched<[]> {
bits<0> ZTt;
bits<3> Zd;
bits<3> Zn;
let Inst{31-21} = 0b11000000100;
let Inst{19-10} = 0b1010000000;
let Inst{9-7} = Zn;
let Inst{6-5} = 0b00;
}

class sme2_luti6_zt_consecutive<string asm>
: sme2_luti6_zt_base<ZZZZ_b_mul_r, asm> {
let Inst{20} = 0;
let Inst{4-2} = Zd;
let Inst{1-0} = 0b00;
}

class sme2_luti6_zt_strided<string asm>
: sme2_luti6_zt_base<ZZZZ_b_strided, asm> {
let Inst{20} = 1;
let Inst{4} = Zd{2};
let Inst{3-2} = 0b00;
let Inst{1-0} = Zd{1-0};
}

//===----------------------------------------------------------------------===//
// Lookup table read with 6-bit indices (8-bit)
class sme2_luti6_vector_vg4_base<RegisterOperand zd_ty, string asm>
: I<(outs zd_ty:$Zd), (ins ZZ_h:$Zn, ZZ_Any:$Zm, VectorIndexD:$i1),
asm, "\t$Zd, $Zn, $Zm$i1", "", []>, Sched<[]> {
bits<3> Zd;
bits<5> Zn;
bits<5> Zm;
bits<1> i1;
let Inst{31-23} = 0b110000010;
let Inst{22} = i1;
let Inst{21} = 0b1;
let Inst{20-16} = Zm;
let Inst{9-5} = Zn;
}

class sme2_luti6_vector_vg4_consecutive<string asm>
: sme2_luti6_vector_vg4_base<ZZZZ_h_mul_r, asm> {
let Inst{15-10} = 0b111101;
let Inst{4-2} = Zd;
let Inst{1-0} = 0b00;
}

class sme2_luti6_vector_vg4_strided<string asm>
: sme2_luti6_vector_vg4_base<ZZZZ_h_strided, asm> {
let Inst{15-10} = 0b111111;
let Inst{4} = Zd{2};
let Inst{3-2} = 0b00;
let Inst{1-0} = Zd{1-0};
}

//===----------------------------------------------------------------------===//
// SME2 MOV
class sme2_mova_vec_to_tile_vg2_multi_base<bits<2> sz, bit v,
Expand Down
31 changes: 27 additions & 4 deletions llvm/lib/Target/AArch64/SVEInstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -11192,7 +11192,7 @@ multiclass sve2_fp8_dot_indexed_s<string asm, SDPatternOperator op> {
def : SVE_4_Op_Pat<nxv4f32, op, nxv4f32, nxv16i8, nxv16i8, i32, !cast<Instruction>(NAME)>;
}

// FP8 Look up table
// Look up table
class sve2_lut_vector_index<ZPRRegOp zd_ty, RegisterOperand zn_ty,
Operand idx_ty, bits<4>opc, string mnemonic>
: I<(outs zd_ty:$Zd), (ins zn_ty:$Zn, ZPRAny:$Zm, idx_ty:$idx),
Expand All @@ -11211,7 +11211,7 @@ class sve2_lut_vector_index<ZPRRegOp zd_ty, RegisterOperand zn_ty,
let Inst{4-0} = Zd;
}

// FP8 Look up table read with 2-bit indices
// Look up table read with 2-bit indices
multiclass sve2_luti2_vector_index<string mnemonic> {
def _B : sve2_lut_vector_index<ZPR8, Z_b, VectorIndexS32b, {?, 0b100}, mnemonic> {
bits<2> idx;
Expand All @@ -11233,7 +11233,7 @@ multiclass sve2_luti2_vector_index<string mnemonic> {
i32, timm32_0_7, !cast<Instruction>(NAME # _H)>;
}

// FP8 Look up table read with 4-bit indices
// Look up table read with 4-bit indices
multiclass sve2_luti4_vector_index<string mnemonic> {
def _B : sve2_lut_vector_index<ZPR8, Z_b, VectorIndexD32b, 0b1001, mnemonic> {
bit idx;
Expand All @@ -11254,7 +11254,7 @@ multiclass sve2_luti4_vector_index<string mnemonic> {
i32, timm32_0_3, !cast<Instruction>(NAME # _H)>;
}

// FP8 Look up table read with 4-bit indices (two contiguous registers)
// Look up table read with 4-bit indices (two contiguous registers)
multiclass sve2_luti4_vector_vg2_index<string mnemonic> {
def NAME : sve2_lut_vector_index<ZPR16, ZZ_h, VectorIndexS32b, {?, 0b101}, mnemonic> {
bits<2> idx;
Expand All @@ -11278,6 +11278,29 @@ multiclass sve2_luti4_vector_vg2_index<string mnemonic> {
nxv16i8:$Op3, timm32_0_3:$Op4))>;
}

// Look up table read with 6-bit indices
multiclass sve2_luti6_vector_index<string mnemonic> {
def _H : sve2_lut_vector_index<ZPR16, ZZ_h, VectorIndexD32b, 0b1011, mnemonic> {
bit idx;
let Inst{23} = idx;
}
}

// Look up table
class sve2_luti6_vector<string mnemonic>
: I<(outs ZPR8:$Zd), (ins ZZ_b:$Zn, ZPRAny:$Zm),
mnemonic, "\t$Zd, $Zn, $Zm",
"", []>, Sched<[]> {
bits<5> Zd;
bits<5> Zn;
bits<5> Zm;
let Inst{31-21} = 0b01000101001;
let Inst{20-16} = Zm;
let Inst{15-10} = 0b101011;
let Inst{9-5} = Zn;
let Inst{4-0} = Zd;
}

//===----------------------------------------------------------------------===//
// Checked Pointer Arithmetic (FEAT_CPA)
//===----------------------------------------------------------------------===//
Expand Down
Loading