Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/AArch64/SVEInstrFormats.td
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | : Pat<(vtd (op vt1:$Op1, vt2:$Op2, (vt3 ImmTy:$Op3))), | ||||
(inst $Op1, $Op2, ImmTy:$Op3)>; | (inst $Op1, $Op2, ImmTy:$Op3)>; | ||||
class SVE_4_Op_Imm_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1, | class SVE_4_Op_Imm_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1, | ||||
ValueType vt2, ValueType vt3, ValueType vt4, | ValueType vt2, ValueType vt3, ValueType vt4, | ||||
Operand ImmTy, Instruction inst> | Operand ImmTy, Instruction inst> | ||||
: Pat<(vtd (op vt1:$Op1, vt2:$Op2, vt3:$Op3, (vt4 ImmTy:$Op4))), | : Pat<(vtd (op vt1:$Op1, vt2:$Op2, vt3:$Op3, (vt4 ImmTy:$Op4))), | ||||
(inst $Op1, $Op2, $Op3, ImmTy:$Op4)>; | (inst $Op1, $Op2, $Op3, ImmTy:$Op4)>; | ||||
def SVEDup0 : ComplexPattern<i64, 0, "SelectDupZero", []>; | |||||
def SVEDup0Undef : ComplexPattern<i64, 0, "SelectDupZeroOrUndef", []>; | def SVEDup0Undef : ComplexPattern<i64, 0, "SelectDupZeroOrUndef", []>; | ||||
let AddedComplexity = 1 in { | |||||
class SVE_3_Op_Pat_SelZero<ValueType vtd, SDPatternOperator op, ValueType vt1, | |||||
ValueType vt2, ValueType vt3, Instruction inst> | |||||
: Pat<(vtd (vtd (op vt1:$Op1, (vselect vt1:$Op1, vt2:$Op2, (SVEDup0)), vt3:$Op3))), | |||||
(inst $Op1, $Op2, $Op3)>; | |||||
} | |||||
// | // | ||||
// Common but less generic patterns. | // Common but less generic patterns. | ||||
// | // | ||||
class SVE_1_Op_AllActive_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1, | class SVE_1_Op_AllActive_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1, | ||||
Instruction inst, Instruction ptrue> | Instruction inst, Instruction ptrue> | ||||
: Pat<(vtd (op vt1:$Op1)), | : Pat<(vtd (op vt1:$Op1)), | ||||
(inst (IMPLICIT_DEF), (ptrue 31), $Op1)>; | (inst (IMPLICIT_DEF), (ptrue 31), $Op1)>; | ||||
// | |||||
// Pseudo -> Instruction mappings | |||||
// | |||||
def getSVEPseudoMap : InstrMapping { | |||||
let FilterClass = "SVEPseudo2Instr"; | |||||
let RowFields = ["PseudoName"]; | |||||
let ColFields = ["IsInstr"]; | |||||
let KeyCol = ["0"]; | |||||
let ValueCols = [["1"]]; | |||||
} | |||||
class SVEPseudo2Instr<string name, bit instr> { | |||||
string PseudoName = name; | |||||
bit IsInstr = instr; | |||||
} | |||||
def getSVERevInstr : InstrMapping { | |||||
let FilterClass = "SVEInstr2Rev"; | |||||
let RowFields = ["InstrName"]; | |||||
let ColFields = ["IsOrig"]; | |||||
let KeyCol = ["1"]; | |||||
let ValueCols = [["0"]]; | |||||
} | |||||
def getSVEOrigInstr : InstrMapping { | |||||
let FilterClass = "SVEInstr2Rev"; | |||||
let RowFields = ["InstrName"]; | |||||
let ColFields = ["IsOrig"]; | |||||
let KeyCol = ["0"]; | |||||
let ValueCols = [["1"]]; | |||||
} | |||||
class SVEInstr2Rev<string name, string revname, bit nameIsOrig> { | |||||
string InstrName = !if(nameIsOrig, name, revname); | |||||
bit IsOrig = nameIsOrig; | |||||
} | |||||
// | |||||
// Pseudos for destructive operands | |||||
// | |||||
let hasNoSchedulingInfo = 1 in { | |||||
class PredTwoOpPseudo<string name, ZPRRegOp zprty, | |||||
FalseLanesEnum flags = FalseLanesNone> | |||||
: SVEPseudo2Instr<name, 0>, | |||||
Pseudo<(outs zprty:$Zd), (ins PPR3bAny:$Pg, zprty:$Zs1, zprty:$Zs2), []> { | |||||
let FalseLanes = flags; | |||||
} | |||||
} | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// SVE Predicate Misc Group | // SVE Predicate Misc Group | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
class sve_int_pfalse<bits<6> opc, string asm> | class sve_int_pfalse<bits<6> opc, string asm> | ||||
: I<(outs PPR8:$Pd), (ins), | : I<(outs PPR8:$Pd), (ins), | ||||
asm, "\t$Pd", | asm, "\t$Pd", | ||||
"", | "", | ||||
▲ Show 20 Lines • Show All 1,033 Lines • ▼ Show 20 Lines | : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm), | ||||
let Inst{9-5} = Zm; | let Inst{9-5} = Zm; | ||||
let Inst{4-0} = Zdn; | let Inst{4-0} = Zdn; | ||||
let Constraints = "$Zdn = $_Zdn"; | let Constraints = "$Zdn = $_Zdn"; | ||||
let DestructiveInstType = DestructiveOther; | let DestructiveInstType = DestructiveOther; | ||||
let ElementSize = zprty.ElementSize; | let ElementSize = zprty.ElementSize; | ||||
} | } | ||||
multiclass sve_fp_2op_p_zds<bits<4> opc, string asm, | multiclass sve_fp_2op_p_zds<bits<4> opc, string asm, string Ps, | ||||
SDPatternOperator op> { | SDPatternOperator op, DestructiveInstTypeEnum flags, | ||||
def _H : sve_fp_2op_p_zds<0b01, opc, asm, ZPR16>; | string revname="", bit isOrig=0> { | ||||
def _S : sve_fp_2op_p_zds<0b10, opc, asm, ZPR32>; | let DestructiveInstType = flags in { | ||||
def _D : sve_fp_2op_p_zds<0b11, opc, asm, ZPR64>; | def _H : sve_fp_2op_p_zds<0b01, opc, asm, ZPR16>, | ||||
SVEPseudo2Instr<Ps # _H, 1>, SVEInstr2Rev<NAME # _H, revname # _H, isOrig>; | |||||
def _S : sve_fp_2op_p_zds<0b10, opc, asm, ZPR32>, | |||||
SVEPseudo2Instr<Ps # _S, 1>, SVEInstr2Rev<NAME # _S, revname # _S, isOrig>; | |||||
def _D : sve_fp_2op_p_zds<0b11, opc, asm, ZPR64>, | |||||
SVEPseudo2Instr<Ps # _D, 1>, SVEInstr2Rev<NAME # _D, revname # _D, isOrig>; | |||||
} | |||||
def : SVE_3_Op_Pat<nxv8f16, op, nxv8i1, nxv8f16, nxv8f16, !cast<Instruction>(NAME # _H)>; | def : SVE_3_Op_Pat<nxv8f16, op, nxv8i1, nxv8f16, nxv8f16, !cast<Instruction>(NAME # _H)>; | ||||
def : SVE_3_Op_Pat<nxv4f32, op, nxv4i1, nxv4f32, nxv4f32, !cast<Instruction>(NAME # _S)>; | def : SVE_3_Op_Pat<nxv4f32, op, nxv4i1, nxv4f32, nxv4f32, !cast<Instruction>(NAME # _S)>; | ||||
def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D)>; | def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D)>; | ||||
} | } | ||||
multiclass sve_fp_2op_p_zds_fscale<bits<4> opc, string asm, | multiclass sve_fp_2op_p_zds_fscale<bits<4> opc, string asm, | ||||
SDPatternOperator op> { | SDPatternOperator op> { | ||||
def _H : sve_fp_2op_p_zds<0b01, opc, asm, ZPR16>; | def _H : sve_fp_2op_p_zds<0b01, opc, asm, ZPR16>; | ||||
def _S : sve_fp_2op_p_zds<0b10, opc, asm, ZPR32>; | def _S : sve_fp_2op_p_zds<0b10, opc, asm, ZPR32>; | ||||
def _D : sve_fp_2op_p_zds<0b11, opc, asm, ZPR64>; | def _D : sve_fp_2op_p_zds<0b11, opc, asm, ZPR64>; | ||||
def : SVE_3_Op_Pat<nxv8f16, op, nxv8i1, nxv8f16, nxv8i16, !cast<Instruction>(NAME # _H)>; | def : SVE_3_Op_Pat<nxv8f16, op, nxv8i1, nxv8f16, nxv8i16, !cast<Instruction>(NAME # _H)>; | ||||
def : SVE_3_Op_Pat<nxv4f32, op, nxv4i1, nxv4f32, nxv4i32, !cast<Instruction>(NAME # _S)>; | def : SVE_3_Op_Pat<nxv4f32, op, nxv4i1, nxv4f32, nxv4i32, !cast<Instruction>(NAME # _S)>; | ||||
def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2i64, !cast<Instruction>(NAME # _D)>; | def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2i64, !cast<Instruction>(NAME # _D)>; | ||||
} | } | ||||
multiclass sve_fp_2op_p_zds_zx<SDPatternOperator op> { | |||||
def _ZERO_H : PredTwoOpPseudo<NAME # _H, ZPR16, FalseLanesZero>; | |||||
def _ZERO_S : PredTwoOpPseudo<NAME # _S, ZPR32, FalseLanesZero>; | |||||
def _ZERO_D : PredTwoOpPseudo<NAME # _D, ZPR64, FalseLanesZero>; | |||||
def : SVE_3_Op_Pat_SelZero<nxv8f16, op, nxv8i1, nxv8f16, nxv8f16, !cast<Pseudo>(NAME # _ZERO_H)>; | |||||
def : SVE_3_Op_Pat_SelZero<nxv4f32, op, nxv4i1, nxv4f32, nxv4f32, !cast<Pseudo>(NAME # _ZERO_S)>; | |||||
def : SVE_3_Op_Pat_SelZero<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, !cast<Pseudo>(NAME # _ZERO_D)>; | |||||
} | |||||
class sve_fp_ftmad<bits<2> sz, string asm, ZPRRegOp zprty> | class sve_fp_ftmad<bits<2> sz, string asm, ZPRRegOp zprty> | ||||
: I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, imm32_0_7:$imm3), | : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, imm32_0_7:$imm3), | ||||
asm, "\t$Zdn, $_Zdn, $Zm, $imm3", | asm, "\t$Zdn, $_Zdn, $Zm, $imm3", | ||||
"", | "", | ||||
[]>, Sched<[]> { | []>, Sched<[]> { | ||||
bits<5> Zdn; | bits<5> Zdn; | ||||
bits<5> Zm; | bits<5> Zm; | ||||
bits<3> imm3; | bits<3> imm3; | ||||
▲ Show 20 Lines • Show All 5,610 Lines • Show Last 20 Lines |