diff options
Diffstat (limited to 'lib/Target/AArch64/AArch64InstrFormats.td')
| -rw-r--r-- | lib/Target/AArch64/AArch64InstrFormats.td | 220 | 
1 files changed, 146 insertions, 74 deletions
diff --git a/lib/Target/AArch64/AArch64InstrFormats.td b/lib/Target/AArch64/AArch64InstrFormats.td index d619137b55c5..f555e4123307 100644 --- a/lib/Target/AArch64/AArch64InstrFormats.td +++ b/lib/Target/AArch64/AArch64InstrFormats.td @@ -480,76 +480,40 @@ def BranchTarget14Operand : BranchTarget<14>;  def BranchTarget26Operand : BranchTarget<26>;  def PCRelLabel19Operand   : PCRelLabel<19>; -def MovZSymbolG3AsmOperand : AsmOperandClass { -  let Name = "MovZSymbolG3"; +def MovWSymbolG3AsmOperand : AsmOperandClass { +  let Name = "MovWSymbolG3";    let RenderMethod = "addImmOperands";  } -def movz_symbol_g3 : Operand<i32> { -  let ParserMatchClass = MovZSymbolG3AsmOperand; +def movw_symbol_g3 : Operand<i32> { +  let ParserMatchClass = MovWSymbolG3AsmOperand;  } -def MovZSymbolG2AsmOperand : AsmOperandClass { -  let Name = "MovZSymbolG2"; +def MovWSymbolG2AsmOperand : AsmOperandClass { +  let Name = "MovWSymbolG2";    let RenderMethod = "addImmOperands";  } -def movz_symbol_g2 : Operand<i32> { -  let ParserMatchClass = MovZSymbolG2AsmOperand; +def movw_symbol_g2 : Operand<i32> { +  let ParserMatchClass = MovWSymbolG2AsmOperand;  } -def MovZSymbolG1AsmOperand : AsmOperandClass { -  let Name = "MovZSymbolG1"; +def MovWSymbolG1AsmOperand : AsmOperandClass { +  let Name = "MovWSymbolG1";    let RenderMethod = "addImmOperands";  } -def movz_symbol_g1 : Operand<i32> { -  let ParserMatchClass = MovZSymbolG1AsmOperand; +def movw_symbol_g1 : Operand<i32> { +  let ParserMatchClass = MovWSymbolG1AsmOperand;  } -def MovZSymbolG0AsmOperand : AsmOperandClass { -  let Name = "MovZSymbolG0"; +def MovWSymbolG0AsmOperand : AsmOperandClass { +  let Name = "MovWSymbolG0";    let RenderMethod = "addImmOperands";  } -def movz_symbol_g0 : Operand<i32> { -  let ParserMatchClass = MovZSymbolG0AsmOperand; -} - -def MovKSymbolG3AsmOperand : AsmOperandClass { -  let Name = "MovKSymbolG3"; -  let RenderMethod = "addImmOperands"; -} - -def movk_symbol_g3 : Operand<i32> { -  let ParserMatchClass = MovKSymbolG3AsmOperand; -} - -def MovKSymbolG2AsmOperand : AsmOperandClass { -  let Name = "MovKSymbolG2"; -  let RenderMethod = "addImmOperands"; -} - -def movk_symbol_g2 : Operand<i32> { -  let ParserMatchClass = MovKSymbolG2AsmOperand; -} - -def MovKSymbolG1AsmOperand : AsmOperandClass { -  let Name = "MovKSymbolG1"; -  let RenderMethod = "addImmOperands"; -} - -def movk_symbol_g1 : Operand<i32> { -  let ParserMatchClass = MovKSymbolG1AsmOperand; -} - -def MovKSymbolG0AsmOperand : AsmOperandClass { -  let Name = "MovKSymbolG0"; -  let RenderMethod = "addImmOperands"; -} - -def movk_symbol_g0 : Operand<i32> { -  let ParserMatchClass = MovKSymbolG0AsmOperand; +def movw_symbol_g0 : Operand<i32> { +  let ParserMatchClass = MovWSymbolG0AsmOperand;  }  class fixedpoint_i32<ValueType FloatVT> @@ -673,6 +637,11 @@ def logical_imm64_XFORM : SDNodeXForm<imm, [{    return CurDAG->getTargetConstant(enc, SDLoc(N), MVT::i32);  }]>; +def gi_logical_imm32_XFORM : GICustomOperandRenderer<"renderLogicalImm32">, +  GISDNodeXFormEquiv<logical_imm32_XFORM>; +def gi_logical_imm64_XFORM : GICustomOperandRenderer<"renderLogicalImm64">, +  GISDNodeXFormEquiv<logical_imm64_XFORM>; +  let DiagnosticType = "LogicalSecondSource" in {    def LogicalImm32Operand : AsmOperandClass {      let Name = "LogicalImm32"; @@ -714,12 +683,15 @@ def logical_imm64_not : Operand<i64> {    let ParserMatchClass = LogicalImm64NotOperand;  } -// imm0_65535 predicate - True if the immediate is in the range [0,65535]. -def imm0_65535 : Operand<i32>, ImmLeaf<i32, [{ +// iXX_imm0_65535 predicates - True if the immediate is in the range [0,65535]. +let ParserMatchClass = AsmImmRange<0, 65535>, PrintMethod = "printImmHex" in { +def i32_imm0_65535 : Operand<i32>, TImmLeaf<i32, [{    return ((uint32_t)Imm) < 65536; -}]> { -  let ParserMatchClass = AsmImmRange<0, 65535>; -  let PrintMethod = "printImmHex"; +}]>; + +def i64_imm0_65535 : Operand<i64>, TImmLeaf<i64, [{ +  return ((uint64_t)Imm) < 65536; +}]>;  }  // imm0_255 predicate - True if the immediate is in the range [0,255]. @@ -815,6 +787,14 @@ class arith_shifted_reg<ValueType Ty, RegisterClass regclass, int width>  def arith_shifted_reg32 : arith_shifted_reg<i32, GPR32, 32>;  def arith_shifted_reg64 : arith_shifted_reg<i64, GPR64, 64>; +def gi_arith_shifted_reg32 : +  GIComplexOperandMatcher<s32, "selectArithShiftedRegister">, +  GIComplexPatternEquiv<arith_shifted_reg32>; + +def gi_arith_shifted_reg64 : +  GIComplexOperandMatcher<s64, "selectArithShiftedRegister">, +  GIComplexPatternEquiv<arith_shifted_reg64>; +  // An arithmetic shifter operand:  //  {7-6} - shift type: 00 = lsl, 01 = lsr, 10 = asr, 11 = ror  //  {5-0} - imm6 @@ -837,6 +817,14 @@ class logical_shifted_reg<ValueType Ty, RegisterClass regclass, Operand shiftop>  def logical_shifted_reg32 : logical_shifted_reg<i32, GPR32, logical_shift32>;  def logical_shifted_reg64 : logical_shifted_reg<i64, GPR64, logical_shift64>; +def gi_logical_shifted_reg32 : +  GIComplexOperandMatcher<s32, "selectLogicalShiftedRegister">, +  GIComplexPatternEquiv<logical_shifted_reg32>; + +def gi_logical_shifted_reg64 : +  GIComplexOperandMatcher<s64, "selectLogicalShiftedRegister">, +  GIComplexPatternEquiv<logical_shifted_reg64>; +  // A logical vector shifter operand:  //  {7-6} - shift type: 00 = lsl  //  {5-0} - imm6: #0, #8, #16, or #24 @@ -918,6 +906,14 @@ class neg_addsub_shifted_imm<ValueType Ty>  def neg_addsub_shifted_imm32 : neg_addsub_shifted_imm<i32>;  def neg_addsub_shifted_imm64 : neg_addsub_shifted_imm<i64>; +def gi_neg_addsub_shifted_imm32 : +    GIComplexOperandMatcher<s32, "selectNegArithImmed">, +    GIComplexPatternEquiv<neg_addsub_shifted_imm32>; + +def gi_neg_addsub_shifted_imm64 : +    GIComplexOperandMatcher<s64, "selectNegArithImmed">, +    GIComplexPatternEquiv<neg_addsub_shifted_imm64>; +  // An extend operand:  //  {5-3} - extend type  //  {2-0} - imm3 @@ -948,6 +944,21 @@ class arith_extended_reg32to64<ValueType Ty> : Operand<Ty>,    let MIOperandInfo = (ops GPR32, arith_extend64);  } +def arith_extended_reg32_i32 : arith_extended_reg32<i32>; +def gi_arith_extended_reg32_i32 : +    GIComplexOperandMatcher<s32, "selectArithExtendedRegister">, +    GIComplexPatternEquiv<arith_extended_reg32_i32>; + +def arith_extended_reg32_i64 : arith_extended_reg32<i64>; +def gi_arith_extended_reg32_i64 : +    GIComplexOperandMatcher<s64, "selectArithExtendedRegister">, +    GIComplexPatternEquiv<arith_extended_reg32_i64>; + +def arith_extended_reg32to64_i64 : arith_extended_reg32to64<i64>; +def gi_arith_extended_reg32to64_i64 : +    GIComplexOperandMatcher<s64, "selectArithExtendedRegister">, +    GIComplexPatternEquiv<arith_extended_reg32to64_i64>; +  // Floating-point immediate.  def fpimm16 : Operand<f16>,                FPImmLeaf<f16, [{ @@ -1000,8 +1011,8 @@ class AsmVectorIndex<int Min, int Max, string NamePrefix=""> : AsmOperandClass {    let RenderMethod = "addVectorIndexOperands";  } -class AsmVectorIndexOpnd<AsmOperandClass mc, code pred> -    : Operand<i64>, ImmLeaf<i64, pred> { +class AsmVectorIndexOpnd<ValueType ty, AsmOperandClass mc, code pred> +    : Operand<ty>, ImmLeaf<ty, pred> {    let ParserMatchClass = mc;    let PrintMethod = "printVectorIndex";  } @@ -1012,11 +1023,17 @@ def VectorIndexHOperand : AsmVectorIndex<0, 7>;  def VectorIndexSOperand : AsmVectorIndex<0, 3>;  def VectorIndexDOperand : AsmVectorIndex<0, 1>; -def VectorIndex1 : AsmVectorIndexOpnd<VectorIndex1Operand, [{ return ((uint64_t)Imm) == 1; }]>; -def VectorIndexB : AsmVectorIndexOpnd<VectorIndexBOperand, [{ return ((uint64_t)Imm) < 16; }]>; -def VectorIndexH : AsmVectorIndexOpnd<VectorIndexHOperand, [{ return ((uint64_t)Imm) < 8; }]>; -def VectorIndexS : AsmVectorIndexOpnd<VectorIndexSOperand, [{ return ((uint64_t)Imm) < 4; }]>; -def VectorIndexD : AsmVectorIndexOpnd<VectorIndexDOperand, [{ return ((uint64_t)Imm) < 2; }]>; +def VectorIndex1 : AsmVectorIndexOpnd<i64, VectorIndex1Operand, [{ return ((uint64_t)Imm) == 1; }]>; +def VectorIndexB : AsmVectorIndexOpnd<i64, VectorIndexBOperand, [{ return ((uint64_t)Imm) < 16; }]>; +def VectorIndexH : AsmVectorIndexOpnd<i64, VectorIndexHOperand, [{ return ((uint64_t)Imm) < 8; }]>; +def VectorIndexS : AsmVectorIndexOpnd<i64, VectorIndexSOperand, [{ return ((uint64_t)Imm) < 4; }]>; +def VectorIndexD : AsmVectorIndexOpnd<i64, VectorIndexDOperand, [{ return ((uint64_t)Imm) < 2; }]>; + +def VectorIndex132b : AsmVectorIndexOpnd<i32, VectorIndex1Operand, [{ return ((uint64_t)Imm) == 1; }]>; +def VectorIndexB32b : AsmVectorIndexOpnd<i32, VectorIndexBOperand, [{ return ((uint64_t)Imm) < 16; }]>; +def VectorIndexH32b : AsmVectorIndexOpnd<i32, VectorIndexHOperand, [{ return ((uint64_t)Imm) < 8; }]>; +def VectorIndexS32b : AsmVectorIndexOpnd<i32, VectorIndexSOperand, [{ return ((uint64_t)Imm) < 4; }]>; +def VectorIndexD32b : AsmVectorIndexOpnd<i32, VectorIndexDOperand, [{ return ((uint64_t)Imm) < 2; }]>;  def SVEVectorIndexExtDupBOperand : AsmVectorIndex<0, 63, "SVE">;  def SVEVectorIndexExtDupHOperand : AsmVectorIndex<0, 31, "SVE">; @@ -1025,15 +1042,15 @@ def SVEVectorIndexExtDupDOperand : AsmVectorIndex<0, 7, "SVE">;  def SVEVectorIndexExtDupQOperand : AsmVectorIndex<0, 3, "SVE">;  def sve_elm_idx_extdup_b -  : AsmVectorIndexOpnd<SVEVectorIndexExtDupBOperand, [{ return ((uint64_t)Imm) < 64; }]>; +  : AsmVectorIndexOpnd<i64, SVEVectorIndexExtDupBOperand, [{ return ((uint64_t)Imm) < 64; }]>;  def sve_elm_idx_extdup_h -  : AsmVectorIndexOpnd<SVEVectorIndexExtDupHOperand, [{ return ((uint64_t)Imm) < 32; }]>; +  : AsmVectorIndexOpnd<i64, SVEVectorIndexExtDupHOperand, [{ return ((uint64_t)Imm) < 32; }]>;  def sve_elm_idx_extdup_s -  : AsmVectorIndexOpnd<SVEVectorIndexExtDupSOperand, [{ return ((uint64_t)Imm) < 16; }]>; +  : AsmVectorIndexOpnd<i64, SVEVectorIndexExtDupSOperand, [{ return ((uint64_t)Imm) < 16; }]>;  def sve_elm_idx_extdup_d -  : AsmVectorIndexOpnd<SVEVectorIndexExtDupDOperand, [{ return ((uint64_t)Imm) < 8; }]>; +  : AsmVectorIndexOpnd<i64, SVEVectorIndexExtDupDOperand, [{ return ((uint64_t)Imm) < 8; }]>;  def sve_elm_idx_extdup_q -  : AsmVectorIndexOpnd<SVEVectorIndexExtDupQOperand, [{ return ((uint64_t)Imm) < 4; }]>; +  : AsmVectorIndexOpnd<i64, SVEVectorIndexExtDupQOperand, [{ return ((uint64_t)Imm) < 4; }]>;  // 8-bit immediate for AdvSIMD where 64-bit values of the form:  // aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh @@ -1082,6 +1099,45 @@ class RtSystemI<bit L, dag oops, dag iops, string asm, string operands>    let Inst{4-0} = Rt;  } +// System instructions for transactional memory extension +class TMBaseSystemI<bit L, bits<4> CRm, bits<3> op2, dag oops, dag iops, +                    string asm, string operands, list<dag> pattern> +    : BaseSystemI<L, oops, iops, asm, operands, pattern>, +      Sched<[WriteSys]> { +  let Inst{20-12} = 0b000110011; +  let Inst{11-8} = CRm; +  let Inst{7-5} = op2; +  let DecoderMethod = ""; + +  let mayLoad = 1; +  let mayStore = 1; +} + +// System instructions for transactional memory - single input operand +class TMSystemI<bits<4> CRm, string asm, list<dag> pattern> +    : TMBaseSystemI<0b1, CRm, 0b011, +                    (outs GPR64:$Rt), (ins), asm, "\t$Rt", pattern> { +  bits<5> Rt; +  let Inst{4-0} = Rt; +} + +// System instructions for transactional memory - no operand +class TMSystemINoOperand<bits<4> CRm, string asm, list<dag> pattern> +    : TMBaseSystemI<0b0, CRm, 0b011, (outs), (ins), asm, "", pattern> { +  let Inst{4-0} = 0b11111; +} + +// System instructions for exit from transactions +class TMSystemException<bits<3> op1, string asm, list<dag> pattern> +    : I<(outs), (ins i64_imm0_65535:$imm), asm, "\t$imm", "", pattern>, +      Sched<[WriteSys]> { +  bits<16> imm; +  let Inst{31-24} = 0b11010100; +  let Inst{23-21} = op1; +  let Inst{20-5}  = imm; +  let Inst{4-0}   = 0b00000; +} +  // Hint instructions that take both a CRm and a 3-bit immediate.  // NOTE: ideally, this would have mayStore = 0, mayLoad = 0, but we cannot  // model patterns with sufficiently fine granularity @@ -2180,11 +2236,11 @@ multiclass AddSub<bit isSub, string mnemonic, string alias,    // Add/Subtract extended register    let AddedComplexity = 1, hasSideEffects = 0 in {    def Wrx : BaseAddSubEReg<isSub, 0, GPR32sp, GPR32sp, -                           arith_extended_reg32<i32>, mnemonic, OpNode> { +                           arith_extended_reg32_i32, mnemonic, OpNode> {      let Inst{31} = 0;    }    def Xrx : BaseAddSubEReg<isSub, 0, GPR64sp, GPR64sp, -                           arith_extended_reg32to64<i64>, mnemonic, OpNode> { +                           arith_extended_reg32to64_i64, mnemonic, OpNode> {      let Inst{31} = 1;    }    } @@ -2254,11 +2310,11 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,    // Add/Subtract extended register    let AddedComplexity = 1 in {    def Wrx : BaseAddSubEReg<isSub, 1, GPR32, GPR32sp, -                           arith_extended_reg32<i32>, mnemonic, OpNode> { +                           arith_extended_reg32_i32, mnemonic, OpNode> {      let Inst{31} = 0;    }    def Xrx : BaseAddSubEReg<isSub, 1, GPR64, GPR64sp, -                           arith_extended_reg32<i64>, mnemonic, OpNode> { +                           arith_extended_reg32_i64, mnemonic, OpNode> {      let Inst{31} = 1;    }    } @@ -2969,6 +3025,22 @@ def ro_Xindexed32 : ComplexPattern<i64, 4, "SelectAddrModeXRO<32>", []>;  def ro_Xindexed64 : ComplexPattern<i64, 4, "SelectAddrModeXRO<64>", []>;  def ro_Xindexed128 : ComplexPattern<i64, 4, "SelectAddrModeXRO<128>", []>; +def gi_ro_Xindexed8 : +    GIComplexOperandMatcher<s64, "selectAddrModeXRO<8>">, +    GIComplexPatternEquiv<ro_Xindexed8>; +def gi_ro_Xindexed16 : +    GIComplexOperandMatcher<s64, "selectAddrModeXRO<16>">, +    GIComplexPatternEquiv<ro_Xindexed16>; +def gi_ro_Xindexed32 : +    GIComplexOperandMatcher<s64, "selectAddrModeXRO<32>">, +    GIComplexPatternEquiv<ro_Xindexed32>; +def gi_ro_Xindexed64 : +    GIComplexOperandMatcher<s64, "selectAddrModeXRO<64>">, +    GIComplexPatternEquiv<ro_Xindexed64>; +def gi_ro_Xindexed128 : +    GIComplexOperandMatcher<s64, "selectAddrModeXRO<128>">, +    GIComplexPatternEquiv<ro_Xindexed128>; +  def ro_Windexed8 : ComplexPattern<i64, 4, "SelectAddrModeWRO<8>", []>;  def ro_Windexed16 : ComplexPattern<i64, 4, "SelectAddrModeWRO<16>", []>;  def ro_Windexed32 : ComplexPattern<i64, 4, "SelectAddrModeWRO<32>", []>; @@ -4086,7 +4158,7 @@ multiclass MemTagStore<bits<2> opc1, string insn> {  let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in  class ExceptionGeneration<bits<3> op1, bits<2> ll, string asm> -    : I<(outs), (ins imm0_65535:$imm), asm, "\t$imm", "", []>, +    : I<(outs), (ins i32_imm0_65535:$imm), asm, "\t$imm", "", []>,        Sched<[WriteSys]> {    bits<16> imm;    let Inst{31-24} = 0b11010100;  | 
