diff options
Diffstat (limited to 'contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td')
-rw-r--r-- | contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td | 813 |
1 files changed, 576 insertions, 237 deletions
diff --git a/contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td index 80c5092a4eed..1060c64f7b5d 100644 --- a/contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/contrib/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -167,7 +167,7 @@ def ExtendOperandLSL64 : AsmOperandClass { // 8-bit floating-point immediate encodings. def FPImmOperand : AsmOperandClass { let Name = "FPImm"; - let ParserMethod = "tryParseFPImm"; + let ParserMethod = "tryParseFPImm<true>"; let DiagnosticType = "InvalidFPImm"; } @@ -179,20 +179,40 @@ def CondCode : AsmOperandClass { // A 32-bit register pasrsed as 64-bit def GPR32as64Operand : AsmOperandClass { let Name = "GPR32as64"; + let ParserMethod = + "tryParseGPROperand<false, RegConstraintEqualityTy::EqualsSubReg>"; } def GPR32as64 : RegisterOperand<GPR32> { let ParserMatchClass = GPR32as64Operand; } +// A 64-bit register pasrsed as 32-bit +def GPR64as32Operand : AsmOperandClass { + let Name = "GPR64as32"; + let ParserMethod = + "tryParseGPROperand<false, RegConstraintEqualityTy::EqualsSuperReg>"; +} +def GPR64as32 : RegisterOperand<GPR64, "printGPR64as32"> { + let ParserMatchClass = GPR64as32Operand; +} + // 8-bit immediate for AdvSIMD where 64-bit values of the form: // aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh // are encoded as the eight bit value 'abcdefgh'. def SIMDImmType10Operand : AsmOperandClass { let Name = "SIMDImmType10"; } -// Authenticated loads for v8.3 can have scaled 10-bit immediate offsets. -def SImm10s8Operand : AsmOperandClass { - let Name = "SImm10s8"; - let DiagnosticType = "InvalidMemoryIndexedSImm10"; +class UImmScaledMemoryIndexed<int Width, int Scale> : AsmOperandClass { + let Name = "UImm" # Width # "s" # Scale; + let DiagnosticType = "InvalidMemoryIndexed" # Scale # "UImm" # Width; + let RenderMethod = "addImmScaledOperands<" # Scale # ">"; + let PredicateMethod = "isUImmScaled<" # Width # ", " # Scale # ">"; +} + +class SImmScaledMemoryIndexed<int Width, int Scale> : AsmOperandClass { + let Name = "SImm" # Width # "s" # Scale; + let DiagnosticType = "InvalidMemoryIndexed" # Scale # "SImm" # Width; + let RenderMethod = "addImmScaledOperands<" # Scale # ">"; + let PredicateMethod = "isSImmScaled<" # Width # ", " # Scale # ">"; } //===----------------------------------------------------------------------===// @@ -221,31 +241,66 @@ def adrlabel : Operand<i64> { let ParserMatchClass = AdrOperand; } +class SImmOperand<int width> : AsmOperandClass { + let Name = "SImm" # width; + let DiagnosticType = "InvalidMemoryIndexedSImm" # width; + let RenderMethod = "addImmOperands"; + let PredicateMethod = "isSImm<" # width # ">"; +} + +// Authenticated loads for v8.3 can have scaled 10-bit immediate offsets. +def SImm10s8Operand : SImmScaledMemoryIndexed<10, 8>; def simm10Scaled : Operand<i64> { let ParserMatchClass = SImm10s8Operand; let DecoderMethod = "DecodeSImm<10>"; let PrintMethod = "printImmScale<8>"; } -// simm9 predicate - True if the immediate is in the range [-256, 255]. -def SImm9Operand : AsmOperandClass { - let Name = "SImm9"; - let DiagnosticType = "InvalidMemoryIndexedSImm9"; +// uimm6 predicate - True if the immediate is in the range [0, 63]. +def UImm6Operand : AsmOperandClass { + let Name = "UImm6"; + let DiagnosticType = "InvalidImm0_63"; +} + +def uimm6 : Operand<i64>, ImmLeaf<i64, [{ return Imm >= 0 && Imm < 64; }]> { + let ParserMatchClass = UImm6Operand; } + +def SImm9Operand : SImmOperand<9>; def simm9 : Operand<i64>, ImmLeaf<i64, [{ return Imm >= -256 && Imm < 256; }]> { let ParserMatchClass = SImm9Operand; + let DecoderMethod = "DecodeSImm<9>"; +} + +def SImm8Operand : SImmOperand<8>; +def simm8 : Operand<i64>, ImmLeaf<i64, [{ return Imm >= -128 && Imm < 127; }]> { + let ParserMatchClass = SImm8Operand; + let DecoderMethod = "DecodeSImm<8>"; +} + +def SImm6Operand : SImmOperand<6>; +def simm6_32b : Operand<i32>, ImmLeaf<i32, [{ return Imm >= -32 && Imm < 32; }]> { + let ParserMatchClass = SImm6Operand; + let DecoderMethod = "DecodeSImm<6>"; +} + +def SImm5Operand : SImmOperand<5>; +def simm5_64b : Operand<i64>, ImmLeaf<i64, [{ return Imm >= -16 && Imm < 16; }]> { + let ParserMatchClass = SImm5Operand; + let DecoderMethod = "DecodeSImm<5>"; +} + +def simm5_32b : Operand<i32>, ImmLeaf<i32, [{ return Imm >= -16 && Imm < 16; }]> { + let ParserMatchClass = SImm5Operand; + let DecoderMethod = "DecodeSImm<5>"; } // simm7sN predicate - True if the immediate is a multiple of N in the range // [-64 * N, 63 * N]. -class SImm7Scaled<int Scale> : AsmOperandClass { - let Name = "SImm7s" # Scale; - let DiagnosticType = "InvalidMemoryIndexed" # Scale # "SImm7"; -} -def SImm7s4Operand : SImm7Scaled<4>; -def SImm7s8Operand : SImm7Scaled<8>; -def SImm7s16Operand : SImm7Scaled<16>; +def SImm7s4Operand : SImmScaledMemoryIndexed<7, 4>; +def SImm7s8Operand : SImmScaledMemoryIndexed<7, 8>; +def SImm7s16Operand : SImmScaledMemoryIndexed<7, 16>; def simm7s4 : Operand<i32> { let ParserMatchClass = SImm7s4Operand; @@ -268,9 +323,107 @@ def am_indexed7s32 : ComplexPattern<i64, 2, "SelectAddrModeIndexed7S32", []>; def am_indexed7s64 : ComplexPattern<i64, 2, "SelectAddrModeIndexed7S64", []>; def am_indexed7s128 : ComplexPattern<i64, 2, "SelectAddrModeIndexed7S128", []>; +// uimm5sN predicate - True if the immediate is a multiple of N in the range +// [0 * N, 32 * N]. +def UImm5s2Operand : UImmScaledMemoryIndexed<5, 2>; +def UImm5s4Operand : UImmScaledMemoryIndexed<5, 4>; +def UImm5s8Operand : UImmScaledMemoryIndexed<5, 8>; + +def uimm5s2 : Operand<i64>, ImmLeaf<i64, + [{ return Imm >= 0 && Imm < (32*2) && ((Imm % 2) == 0); }]> { + let ParserMatchClass = UImm5s2Operand; + let PrintMethod = "printImmScale<2>"; +} +def uimm5s4 : Operand<i64>, ImmLeaf<i64, + [{ return Imm >= 0 && Imm < (32*4) && ((Imm % 4) == 0); }]> { + let ParserMatchClass = UImm5s4Operand; + let PrintMethod = "printImmScale<4>"; +} +def uimm5s8 : Operand<i64>, ImmLeaf<i64, + [{ return Imm >= 0 && Imm < (32*8) && ((Imm % 8) == 0); }]> { + let ParserMatchClass = UImm5s8Operand; + let PrintMethod = "printImmScale<8>"; +} + +// uimm6sN predicate - True if the immediate is a multiple of N in the range +// [0 * N, 64 * N]. +def UImm6s1Operand : UImmScaledMemoryIndexed<6, 1>; +def UImm6s2Operand : UImmScaledMemoryIndexed<6, 2>; +def UImm6s4Operand : UImmScaledMemoryIndexed<6, 4>; +def UImm6s8Operand : UImmScaledMemoryIndexed<6, 8>; + +def uimm6s1 : Operand<i64>, ImmLeaf<i64, [{ return Imm >= 0 && Imm < 64; }]> { + let ParserMatchClass = UImm6s1Operand; +} +def uimm6s2 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >= 0 && Imm < (64*2) && ((Imm % 2) == 0); }]> { + let PrintMethod = "printImmScale<2>"; + let ParserMatchClass = UImm6s2Operand; +} +def uimm6s4 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >= 0 && Imm < (64*4) && ((Imm % 4) == 0); }]> { + let PrintMethod = "printImmScale<4>"; + let ParserMatchClass = UImm6s4Operand; +} +def uimm6s8 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >= 0 && Imm < (64*8) && ((Imm % 8) == 0); }]> { + let PrintMethod = "printImmScale<8>"; + let ParserMatchClass = UImm6s8Operand; +} + +// simm6sN predicate - True if the immediate is a multiple of N in the range +// [-32 * N, 31 * N]. +def SImm6s1Operand : SImmScaledMemoryIndexed<6, 1>; +def simm6s1 : Operand<i64>, ImmLeaf<i64, [{ return Imm >= -32 && Imm < 32; }]> { + let ParserMatchClass = SImm6s1Operand; + let DecoderMethod = "DecodeSImm<6>"; +} + +// simm4sN predicate - True if the immediate is a multiple of N in the range +// [ -8* N, 7 * N]. +def SImm4s1Operand : SImmScaledMemoryIndexed<4, 1>; +def SImm4s2Operand : SImmScaledMemoryIndexed<4, 2>; +def SImm4s3Operand : SImmScaledMemoryIndexed<4, 3>; +def SImm4s4Operand : SImmScaledMemoryIndexed<4, 4>; +def SImm4s16Operand : SImmScaledMemoryIndexed<4, 16>; + +def simm4s1 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >=-8 && Imm <= 7; }]> { + let ParserMatchClass = SImm4s1Operand; + let DecoderMethod = "DecodeSImm<4>"; +} + +def simm4s2 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >=-16 && Imm <= 14 && (Imm % 2) == 0x0; }]> { + let PrintMethod = "printImmScale<2>"; + let ParserMatchClass = SImm4s2Operand; + let DecoderMethod = "DecodeSImm<4>"; +} + +def simm4s3 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >=-24 && Imm <= 21 && (Imm % 3) == 0x0; }]> { + let PrintMethod = "printImmScale<3>"; + let ParserMatchClass = SImm4s3Operand; + let DecoderMethod = "DecodeSImm<4>"; +} + +def simm4s4 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >=-32 && Imm <= 28 && (Imm % 4) == 0x0; }]> { + let PrintMethod = "printImmScale<4>"; + let ParserMatchClass = SImm4s4Operand; + let DecoderMethod = "DecodeSImm<4>"; +} +def simm4s16 : Operand<i64>, ImmLeaf<i64, +[{ return Imm >=-128 && Imm <= 112 && (Imm % 16) == 0x0; }]> { + let PrintMethod = "printImmScale<16>"; + let ParserMatchClass = SImm4s16Operand; + let DecoderMethod = "DecodeSImm<4>"; +} + class AsmImmRange<int Low, int High> : AsmOperandClass { let Name = "Imm" # Low # "_" # High; let DiagnosticType = "InvalidImm" # Low # "_" # High; + let RenderMethod = "addImmOperands"; let PredicateMethod = "isImmInRange<" # Low # "," # High # ">"; } @@ -489,27 +642,35 @@ def logical_imm64_XFORM : SDNodeXForm<imm, [{ let DiagnosticType = "LogicalSecondSource" in { def LogicalImm32Operand : AsmOperandClass { let Name = "LogicalImm32"; + let PredicateMethod = "isLogicalImm<int32_t>"; + let RenderMethod = "addLogicalImmOperands<int32_t>"; } def LogicalImm64Operand : AsmOperandClass { let Name = "LogicalImm64"; + let PredicateMethod = "isLogicalImm<int64_t>"; + let RenderMethod = "addLogicalImmOperands<int64_t>"; } def LogicalImm32NotOperand : AsmOperandClass { let Name = "LogicalImm32Not"; + let PredicateMethod = "isLogicalImm<int32_t>"; + let RenderMethod = "addLogicalImmNotOperands<int32_t>"; } def LogicalImm64NotOperand : AsmOperandClass { let Name = "LogicalImm64Not"; + let PredicateMethod = "isLogicalImm<int64_t>"; + let RenderMethod = "addLogicalImmNotOperands<int64_t>"; } } def logical_imm32 : Operand<i32>, IntImmLeaf<i32, [{ return AArch64_AM::isLogicalImmediate(Imm.getZExtValue(), 32); }], logical_imm32_XFORM> { - let PrintMethod = "printLogicalImm32"; + let PrintMethod = "printLogicalImm<int32_t>"; let ParserMatchClass = LogicalImm32Operand; } def logical_imm64 : Operand<i64>, IntImmLeaf<i64, [{ return AArch64_AM::isLogicalImmediate(Imm.getZExtValue(), 64); }], logical_imm64_XFORM> { - let PrintMethod = "printLogicalImm64"; + let PrintMethod = "printLogicalImm<int64_t>"; let ParserMatchClass = LogicalImm64Operand; } def logical_imm32_not : Operand<i32> { @@ -672,11 +833,13 @@ def move_vec_shift : Operand<i32> { let DiagnosticType = "AddSubSecondSource" in { def AddSubImmOperand : AsmOperandClass { let Name = "AddSubImm"; - let ParserMethod = "tryParseAddSubImm"; + let ParserMethod = "tryParseImmWithOptionalShift"; + let RenderMethod = "addImmWithOptionalShiftOperands<12>"; } def AddSubImmNegOperand : AsmOperandClass { let Name = "AddSubImmNeg"; - let ParserMethod = "tryParseAddSubImm"; + let ParserMethod = "tryParseImmWithOptionalShift"; + let RenderMethod = "addImmNegWithOptionalShiftOperands<12>"; } } // An ADD/SUB immediate shifter operand: @@ -797,52 +960,48 @@ def fpimm0 : FPImmLeaf<fAny, [{ }]>; // Vector lane operands -class AsmVectorIndex<string Suffix> : AsmOperandClass { - let Name = "VectorIndex" # Suffix; - let DiagnosticType = "InvalidIndex" # Suffix; -} -def VectorIndex1Operand : AsmVectorIndex<"1">; -def VectorIndexBOperand : AsmVectorIndex<"B">; -def VectorIndexHOperand : AsmVectorIndex<"H">; -def VectorIndexSOperand : AsmVectorIndex<"S">; -def VectorIndexDOperand : AsmVectorIndex<"D">; - -def VectorIndex1 : Operand<i64>, ImmLeaf<i64, [{ - return ((uint64_t)Imm) == 1; -}]> { - let ParserMatchClass = VectorIndex1Operand; - let PrintMethod = "printVectorIndex"; - let MIOperandInfo = (ops i64imm); -} -def VectorIndexB : Operand<i64>, ImmLeaf<i64, [{ - return ((uint64_t)Imm) < 16; -}]> { - let ParserMatchClass = VectorIndexBOperand; - let PrintMethod = "printVectorIndex"; - let MIOperandInfo = (ops i64imm); -} -def VectorIndexH : Operand<i64>, ImmLeaf<i64, [{ - return ((uint64_t)Imm) < 8; -}]> { - let ParserMatchClass = VectorIndexHOperand; - let PrintMethod = "printVectorIndex"; - let MIOperandInfo = (ops i64imm); +class AsmVectorIndex<int Min, int Max, string NamePrefix=""> : AsmOperandClass { + let Name = NamePrefix # "IndexRange" # Min # "_" # Max; + let DiagnosticType = "Invalid" # Name; + let PredicateMethod = "isVectorIndex<" # Min # ", " # Max # ">"; + let RenderMethod = "addVectorIndexOperands"; } -def VectorIndexS : Operand<i64>, ImmLeaf<i64, [{ - return ((uint64_t)Imm) < 4; -}]> { - let ParserMatchClass = VectorIndexSOperand; - let PrintMethod = "printVectorIndex"; - let MIOperandInfo = (ops i64imm); -} -def VectorIndexD : Operand<i64>, ImmLeaf<i64, [{ - return ((uint64_t)Imm) < 2; -}]> { - let ParserMatchClass = VectorIndexDOperand; + +class AsmVectorIndexOpnd<AsmOperandClass mc, code pred> + : Operand<i64>, ImmLeaf<i64, pred> { + let ParserMatchClass = mc; let PrintMethod = "printVectorIndex"; - let MIOperandInfo = (ops i64imm); } +def VectorIndex1Operand : AsmVectorIndex<1, 1>; +def VectorIndexBOperand : AsmVectorIndex<0, 15>; +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 SVEVectorIndexExtDupBOperand : AsmVectorIndex<0, 63, "SVE">; +def SVEVectorIndexExtDupHOperand : AsmVectorIndex<0, 31, "SVE">; +def SVEVectorIndexExtDupSOperand : AsmVectorIndex<0, 15, "SVE">; +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; }]>; +def sve_elm_idx_extdup_h + : AsmVectorIndexOpnd<SVEVectorIndexExtDupHOperand, [{ return ((uint64_t)Imm) < 32; }]>; +def sve_elm_idx_extdup_s + : AsmVectorIndexOpnd<SVEVectorIndexExtDupSOperand, [{ return ((uint64_t)Imm) < 16; }]>; +def sve_elm_idx_extdup_d + : AsmVectorIndexOpnd<SVEVectorIndexExtDupDOperand, [{ return ((uint64_t)Imm) < 8; }]>; +def sve_elm_idx_extdup_q + : AsmVectorIndexOpnd<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 // are encoded as the eight bit value 'abcdefgh'. @@ -1224,6 +1383,7 @@ def am_brcond : Operand<OtherVT> { let DecoderMethod = "DecodePCRelLabel19"; let PrintMethod = "printAlignedLabel"; let ParserMatchClass = PCRelLabel19Operand; + let OperandType = "OPERAND_PCREL"; } class BranchCond : I<(outs), (ins ccode:$cond, am_brcond:$target), @@ -1279,18 +1439,20 @@ def am_tbrcond : Operand<OtherVT> { let EncoderMethod = "getTestBranchTargetOpValue"; let PrintMethod = "printAlignedLabel"; let ParserMatchClass = BranchTarget14Operand; + let OperandType = "OPERAND_PCREL"; } // AsmOperand classes to emit (or not) special diagnostics def TBZImm0_31Operand : AsmOperandClass { let Name = "TBZImm0_31"; let PredicateMethod = "isImmInRange<0,31>"; - let RenderMethod = "addImm0_31Operands"; + let RenderMethod = "addImmOperands"; } def TBZImm32_63Operand : AsmOperandClass { let Name = "Imm32_63"; let PredicateMethod = "isImmInRange<32,63>"; let DiagnosticType = "InvalidImm0_63"; + let RenderMethod = "addImmOperands"; } class tbz_imm0_31<AsmOperandClass matcher> : Operand<i64>, ImmLeaf<i64, [{ @@ -1355,11 +1517,13 @@ def am_b_target : Operand<OtherVT> { let EncoderMethod = "getBranchTargetOpValue"; let PrintMethod = "printAlignedLabel"; let ParserMatchClass = BranchTarget26Operand; + let OperandType = "OPERAND_PCREL"; } def am_bl_target : Operand<i64> { let EncoderMethod = "getBranchTargetOpValue"; let PrintMethod = "printAlignedLabel"; let ParserMatchClass = BranchTarget26Operand; + let OperandType = "OPERAND_PCREL"; } class BImm<bit op, dag iops, string asm, list<dag> pattern> @@ -1458,6 +1622,30 @@ class SignAuthTwoOperand<bits<4> opc, string asm, let Inst{4-0} = Rd; } +// Base class for the Armv8.4-A 8 and 16-bit flag manipulation instructions +class BaseFlagManipulation<bit sf, bit sz, dag iops, string asm, string ops> + : I<(outs), iops, asm, ops, "", []>, + Sched<[WriteI, ReadI, ReadI]> { + let Uses = [NZCV]; + bits<5> Rn; + let Inst{31} = sf; + let Inst{30-15} = 0b0111010000000000; + let Inst{14} = sz; + let Inst{13-10} = 0b0010; + let Inst{9-5} = Rn; + let Inst{4-0} = 0b01101; +} + +class FlagRotate<dag iops, string asm, string ops> + : BaseFlagManipulation<0b1, 0b0, iops, asm, ops> { + bits<6> imm; + bits<4> mask; + let Inst{20-15} = imm; + let Inst{13-10} = 0b0001; + let Inst{4} = 0b0; + let Inst{3-0} = mask; +} + //--- // Basic two-operand data processing instructions. //--- @@ -2579,7 +2767,7 @@ class BaseLoadStoreUI<bits<2> sz, bit V, bits<2> opc, dag oops, dag iops, let DecoderMethod = "DecodeUnsignedLdStInstruction"; } -multiclass LoadUI<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass LoadUI<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, Operand indextype, string asm, list<dag> pattern> { let AddedComplexity = 10, mayLoad = 1, mayStore = 0, hasSideEffects = 0 in def ui : BaseLoadStoreUI<sz, V, opc, (outs regtype:$Rt), @@ -2591,7 +2779,7 @@ multiclass LoadUI<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, (!cast<Instruction>(NAME # "ui") regtype:$Rt, GPR64sp:$Rn, 0)>; } -multiclass StoreUI<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass StoreUI<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, Operand indextype, string asm, list<dag> pattern> { let AddedComplexity = 10, mayLoad = 0, mayStore = 1, hasSideEffects = 0 in def ui : BaseLoadStoreUI<sz, V, opc, (outs), @@ -2647,10 +2835,11 @@ def am_ldrlit : Operand<iPTR> { let DecoderMethod = "DecodePCRelLabel19"; let PrintMethod = "printAlignedLabel"; let ParserMatchClass = PCRelLabel19Operand; + let OperandType = "OPERAND_PCREL"; } let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in -class LoadLiteral<bits<2> opc, bit V, RegisterClass regtype, string asm> +class LoadLiteral<bits<2> opc, bit V, RegisterOperand regtype, string asm> : I<(outs regtype:$Rt), (ins am_ldrlit:$label), asm, "\t$Rt, $label", "", []>, Sched<[WriteLD]> { @@ -2761,7 +2950,7 @@ def ro64 : ROAddrMode<ro_Windexed64, ro_Xindexed64, ro_Wextend64, ro_Xextend64>; def ro128 : ROAddrMode<ro_Windexed128, ro_Xindexed128, ro_Wextend128, ro_Xextend128>; -class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, dag ins, dag outs, list<dag> pat> : I<ins, outs, asm, "\t$Rt, [$Rn, $Rm, $extend]", "", pat> { bits<5> Rt; @@ -2783,11 +2972,11 @@ class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, let Inst{4-0} = Rt; } -class ROInstAlias<string asm, RegisterClass regtype, Instruction INST> +class ROInstAlias<string asm, RegisterOperand regtype, Instruction INST> : InstAlias<asm # "\t$Rt, [$Rn, $Rm]", (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, 0, 0)>; -multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator loadop> { let AddedComplexity = 10 in def roW : LoadStore8RO<sz, V, opc, regtype, asm, @@ -2814,7 +3003,7 @@ multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator storeop> { let AddedComplexity = 10 in def roW : LoadStore8RO<sz, V, opc, regtype, asm, (outs), @@ -2839,7 +3028,7 @@ multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, dag ins, dag outs, list<dag> pat> : I<ins, outs, asm, "\t$Rt, [$Rn, $Rm, $extend]", "", pat> { bits<5> Rt; @@ -2861,7 +3050,7 @@ class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, let Inst{4-0} = Rt; } -multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator loadop> { let AddedComplexity = 10 in def roW : LoadStore16RO<sz, V, opc, regtype, asm, (outs regtype:$Rt), @@ -2886,7 +3075,7 @@ multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator storeop> { let AddedComplexity = 10 in def roW : LoadStore16RO<sz, V, opc, regtype, asm, (outs), @@ -2911,7 +3100,7 @@ multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, dag ins, dag outs, list<dag> pat> : I<ins, outs, asm, "\t$Rt, [$Rn, $Rm, $extend]", "", pat> { bits<5> Rt; @@ -2933,7 +3122,7 @@ class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, let Inst{4-0} = Rt; } -multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator loadop> { let AddedComplexity = 10 in def roW : LoadStore32RO<sz, V, opc, regtype, asm, (outs regtype:$Rt), @@ -2958,7 +3147,7 @@ multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator storeop> { let AddedComplexity = 10 in def roW : LoadStore32RO<sz, V, opc, regtype, asm, (outs), @@ -2983,7 +3172,7 @@ multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, dag ins, dag outs, list<dag> pat> : I<ins, outs, asm, "\t$Rt, [$Rn, $Rm, $extend]", "", pat> { bits<5> Rt; @@ -3005,7 +3194,7 @@ class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, let Inst{4-0} = Rt; } -multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator loadop> { let AddedComplexity = 10, mayLoad = 1, mayStore = 0, hasSideEffects = 0 in def roW : LoadStore64RO<sz, V, opc, regtype, asm, (outs regtype:$Rt), @@ -3030,7 +3219,7 @@ multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator storeop> { let AddedComplexity = 10, mayLoad = 0, mayStore = 1, hasSideEffects = 0 in def roW : LoadStore64RO<sz, V, opc, regtype, asm, (outs), @@ -3055,7 +3244,7 @@ multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, dag ins, dag outs, list<dag> pat> : I<ins, outs, asm, "\t$Rt, [$Rn, $Rm, $extend]", "", pat> { bits<5> Rt; @@ -3077,7 +3266,7 @@ class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, let Inst{4-0} = Rt; } -multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator loadop> { let AddedComplexity = 10, mayLoad = 1, mayStore = 0, hasSideEffects = 0 in def roW : LoadStore128RO<sz, V, opc, regtype, asm, (outs regtype:$Rt), @@ -3102,7 +3291,7 @@ multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>; } -multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, ValueType Ty, SDPatternOperator storeop> { let mayLoad = 0, mayStore = 1, hasSideEffects = 0 in def roW : LoadStore128RO<sz, V, opc, regtype, asm, (outs), @@ -3216,7 +3405,33 @@ class BaseLoadStoreUnscale<bits<2> sz, bit V, bits<2> opc, dag oops, dag iops, let DecoderMethod = "DecodeSignedLdStInstruction"; } -multiclass LoadUnscaled<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +// Armv8.4 LDAPR & STLR with Immediate Offset instruction +multiclass BaseLoadUnscaleV84<string asm, bits<2> sz, bits<2> opc, + RegisterOperand regtype > { + def i : BaseLoadStoreUnscale<sz, 0, opc, (outs regtype:$Rt), + (ins GPR64sp:$Rn, simm9:$offset), asm, []>, + Sched<[WriteST]> { + let Inst{29} = 0; + let Inst{24} = 1; + } + def : InstAlias<asm # "\t$Rt, [$Rn]", + (!cast<Instruction>(NAME # "i") regtype:$Rt, GPR64sp:$Rn, 0)>; +} + +multiclass BaseStoreUnscaleV84<string asm, bits<2> sz, bits<2> opc, + RegisterOperand regtype > { + def i : BaseLoadStoreUnscale<sz, 0, opc, (outs), + (ins regtype:$Rt, GPR64sp:$Rn, simm9:$offset), + asm, []>, + Sched<[WriteST]> { + let Inst{29} = 0; + let Inst{24} = 1; + } + def : InstAlias<asm # "\t$Rt, [$Rn]", + (!cast<Instruction>(NAME # "i") regtype:$Rt, GPR64sp:$Rn, 0)>; +} + +multiclass LoadUnscaled<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, list<dag> pattern> { let AddedComplexity = 1 in // try this before LoadUI def i : BaseLoadStoreUnscale<sz, V, opc, (outs regtype:$Rt), @@ -3227,7 +3442,7 @@ multiclass LoadUnscaled<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, (!cast<Instruction>(NAME # "i") regtype:$Rt, GPR64sp:$Rn, 0)>; } -multiclass StoreUnscaled<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +multiclass StoreUnscaled<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, list<dag> pattern> { let AddedComplexity = 1 in // try this before StoreUI def i : BaseLoadStoreUnscale<sz, V, opc, (outs), @@ -3324,7 +3539,7 @@ class BaseLoadStorePreIdx<bits<2> sz, bit V, bits<2> opc, dag oops, dag iops, let hasSideEffects = 0 in { let mayStore = 0, mayLoad = 1 in -class LoadPreIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadPreIdx<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm> : BaseLoadStorePreIdx<sz, V, opc, (outs GPR64sp:$wback, regtype:$Rt), @@ -3333,7 +3548,7 @@ class LoadPreIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, Sched<[WriteLD, WriteAdr]>; let mayStore = 1, mayLoad = 0 in -class StorePreIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class StorePreIdx<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, SDPatternOperator storeop, ValueType Ty> : BaseLoadStorePreIdx<sz, V, opc, (outs GPR64sp:$wback), @@ -3370,16 +3585,16 @@ class BaseLoadStorePostIdx<bits<2> sz, bit V, bits<2> opc, dag oops, dag iops, let hasSideEffects = 0 in { let mayStore = 0, mayLoad = 1 in -class LoadPostIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class LoadPostIdx<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm> : BaseLoadStorePostIdx<sz, V, opc, (outs GPR64sp:$wback, regtype:$Rt), (ins GPR64sp:$Rn, simm9:$offset), asm, "$Rn = $wback,@earlyclobber $wback", []>, - Sched<[WriteLD, WriteI]>; + Sched<[WriteLD, WriteAdr]>; let mayStore = 1, mayLoad = 0 in -class StorePostIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, +class StorePostIdx<bits<2> sz, bit V, bits<2> opc, RegisterOperand regtype, string asm, SDPatternOperator storeop, ValueType Ty> : BaseLoadStorePostIdx<sz, V, opc, (outs GPR64sp:$wback), @@ -3387,7 +3602,7 @@ class StorePostIdx<bits<2> sz, bit V, bits<2> opc, RegisterClass regtype, asm, "$Rn = $wback,@earlyclobber $wback", [(set GPR64sp:$wback, (storeop (Ty regtype:$Rt), GPR64sp:$Rn, simm9:$offset))]>, - Sched<[WriteAdr, WriteST, ReadAdrBase]>; + Sched<[WriteAdr, WriteST]>; } // hasSideEffects = 0 @@ -3417,7 +3632,7 @@ class BaseLoadStorePairOffset<bits<2> opc, bit V, bit L, dag oops, dag iops, let DecoderMethod = "DecodePairLdStInstruction"; } -multiclass LoadPairOffset<bits<2> opc, bit V, RegisterClass regtype, +multiclass LoadPairOffset<bits<2> opc, bit V, RegisterOperand regtype, Operand indextype, string asm> { let hasSideEffects = 0, mayStore = 0, mayLoad = 1 in def i : BaseLoadStorePairOffset<opc, V, 1, @@ -3431,7 +3646,7 @@ multiclass LoadPairOffset<bits<2> opc, bit V, RegisterClass regtype, } -multiclass StorePairOffset<bits<2> opc, bit V, RegisterClass regtype, +multiclass StorePairOffset<bits<2> opc, bit V, RegisterOperand regtype, Operand indextype, string asm> { let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in def i : BaseLoadStorePairOffset<opc, V, 0, (outs), @@ -3468,7 +3683,7 @@ class BaseLoadStorePairPreIdx<bits<2> opc, bit V, bit L, dag oops, dag iops, let hasSideEffects = 0 in { let mayStore = 0, mayLoad = 1 in -class LoadPairPreIdx<bits<2> opc, bit V, RegisterClass regtype, +class LoadPairPreIdx<bits<2> opc, bit V, RegisterOperand regtype, Operand indextype, string asm> : BaseLoadStorePairPreIdx<opc, V, 1, (outs GPR64sp:$wback, regtype:$Rt, regtype:$Rt2), @@ -3476,7 +3691,7 @@ class LoadPairPreIdx<bits<2> opc, bit V, RegisterClass regtype, Sched<[WriteLD, WriteLDHi, WriteAdr]>; let mayStore = 1, mayLoad = 0 in -class StorePairPreIdx<bits<2> opc, bit V, RegisterClass regtype, +class StorePairPreIdx<bits<2> opc, bit V, RegisterOperand regtype, Operand indextype, string asm> : BaseLoadStorePairPreIdx<opc, V, 0, (outs GPR64sp:$wback), (ins regtype:$Rt, regtype:$Rt2, @@ -3509,7 +3724,7 @@ class BaseLoadStorePairPostIdx<bits<2> opc, bit V, bit L, dag oops, dag iops, let hasSideEffects = 0 in { let mayStore = 0, mayLoad = 1 in -class LoadPairPostIdx<bits<2> opc, bit V, RegisterClass regtype, +class LoadPairPostIdx<bits<2> opc, bit V, RegisterOperand regtype, Operand idxtype, string asm> : BaseLoadStorePairPostIdx<opc, V, 1, (outs GPR64sp:$wback, regtype:$Rt, regtype:$Rt2), @@ -3517,7 +3732,7 @@ class LoadPairPostIdx<bits<2> opc, bit V, RegisterClass regtype, Sched<[WriteLD, WriteLDHi, WriteAdr]>; let mayStore = 1, mayLoad = 0 in -class StorePairPostIdx<bits<2> opc, bit V, RegisterClass regtype, +class StorePairPostIdx<bits<2> opc, bit V, RegisterOperand regtype, Operand idxtype, string asm> : BaseLoadStorePairPostIdx<opc, V, 0, (outs GPR64sp:$wback), (ins regtype:$Rt, regtype:$Rt2, @@ -4559,11 +4774,24 @@ class BaseSIMDThreeSameVectorTied<bit Q, bit U, bits<3> size, bits<5> opcode, } class BaseSIMDThreeSameVectorDot<bit Q, bit U, string asm, string kind1, - string kind2> : - BaseSIMDThreeSameVector<Q, U, 0b100, 0b10010, V128, asm, kind1, [] > { + string kind2, RegisterOperand RegType, + ValueType AccumType, ValueType InputType, + SDPatternOperator OpNode> : + BaseSIMDThreeSameVectorTied<Q, U, 0b100, 0b10010, RegType, asm, kind1, + [(set (AccumType RegType:$dst), + (OpNode (AccumType RegType:$Rd), + (InputType RegType:$Rn), + (InputType RegType:$Rm)))]> { let AsmString = !strconcat(asm, "{\t$Rd" # kind1 # ", $Rn" # kind2 # ", $Rm" # kind2 # "}"); } +multiclass SIMDThreeSameVectorDot<bit U, string asm, SDPatternOperator OpNode> { + def v8i8 : BaseSIMDThreeSameVectorDot<0, U, asm, ".2s", ".8b", V64, + v2i32, v8i8, OpNode>; + def v16i8 : BaseSIMDThreeSameVectorDot<1, U, asm, ".4s", ".16b", V128, + v4i32, v16i8, OpNode>; +} + // All operand sizes distinguished in the encoding. multiclass SIMDThreeSameVector<bit U, bits<5> opc, string asm, SDPatternOperator OpNode> { @@ -5492,7 +5720,7 @@ multiclass SIMDDifferentThreeVectorBD<bit U, bits<4> opc, string asm, def v16i8 : BaseSIMDDifferentThreeVector<U, 0b001, opc, V128, V128, V128, asm#"2", ".8h", ".16b", ".16b", []>; - let Predicates = [HasCrypto] in { + let Predicates = [HasAES] in { def v1i64 : BaseSIMDDifferentThreeVector<U, 0b110, opc, V128, V64, V64, asm, ".1q", ".1d", ".1d", []>; @@ -5911,10 +6139,10 @@ multiclass SIMDThreeScalarHS<bit U, bits<5> opc, string asm, multiclass SIMDThreeScalarHSTied<bit U, bit R, bits<5> opc, string asm, SDPatternOperator OpNode = null_frag> { def v1i32: BaseSIMDThreeScalarTied<U, 0b10, R, opc, (outs FPR32:$dst), - (ins FPR32:$Rd, FPR32:$Rn, FPR32:$Rm), + (ins FPR32:$Rd, FPR32:$Rn, FPR32:$Rm), asm, []>; def v1i16: BaseSIMDThreeScalarTied<U, 0b01, R, opc, (outs FPR16:$dst), - (ins FPR16:$Rd, FPR16:$Rn, FPR16:$Rm), + (ins FPR16:$Rd, FPR16:$Rn, FPR16:$Rm), asm, []>; } @@ -6993,14 +7221,31 @@ class BaseSIMDIndexedTied<bit Q, bit U, bit Scalar, bits<2> size, bits<4> opc, // ARMv8.2 Index Dot product instructions class BaseSIMDThreeSameVectorDotIndex<bit Q, bit U, string asm, string dst_kind, - string lhs_kind, string rhs_kind> : - BaseSIMDIndexedTied<Q, U, 0b0, 0b10, 0b1110, V128, V128, V128, VectorIndexS, - asm, "", dst_kind, lhs_kind, rhs_kind, []> { + string lhs_kind, string rhs_kind, + RegisterOperand RegType, + ValueType AccumType, ValueType InputType, + SDPatternOperator OpNode> : + BaseSIMDIndexedTied<Q, U, 0b0, 0b10, 0b1110, RegType, RegType, V128, + VectorIndexS, asm, "", dst_kind, lhs_kind, rhs_kind, + [(set (AccumType RegType:$dst), + (AccumType (OpNode (AccumType RegType:$Rd), + (InputType RegType:$Rn), + (InputType (bitconvert (AccumType + (AArch64duplane32 (v4i32 V128:$Rm), + VectorIndexS:$idx)))))))]> { bits<2> idx; let Inst{21} = idx{0}; // L let Inst{11} = idx{1}; // H } +multiclass SIMDThreeSameVectorDotIndex<bit U, string asm, + SDPatternOperator OpNode> { + def v8i8 : BaseSIMDThreeSameVectorDotIndex<0, U, asm, ".2s", ".8b", ".4b", V64, + v2i32, v8i8, OpNode>; + def v16i8 : BaseSIMDThreeSameVectorDotIndex<1, U, asm, ".4s", ".16b", ".4b", V128, + v4i32, v16i8, OpNode>; +} + multiclass SIMDFPIndexed<bit U, bits<4> opc, string asm, SDPatternOperator OpNode> { let Predicates = [HasNEON, HasFullFP16] in { @@ -7765,7 +8010,6 @@ multiclass SIMDFPScalarRShift<bit U, bits<5> opc, string asm> { FPR32, FPR32, vecshiftR32, asm, []> { let Inst{20-16} = imm{4-0}; } - def d : BaseSIMDScalarShift<U, opc, {1,?,?,?,?,?,?}, FPR64, FPR64, vecshiftR64, asm, []> { let Inst{21-16} = imm{5-0}; @@ -8468,14 +8712,14 @@ class BaseSIMDLdStPost<bit Q, bit L, bits<4> opcode, bits<2> size, // The immediate form of AdvSIMD post-indexed addressing is encoded with // register post-index addressing from the zero register. -multiclass SIMDLdStAliases<string asm, string layout, string Count, +multiclass SIMDLdStAliases<string BaseName, string asm, string layout, string Count, int Offset, int Size> { // E.g. "ld1 { v0.8b, v1.8b }, [x1], #16" // "ld1\t$Vt, [$Rn], #16" // may get mapped to // (LD1Twov8b_POST VecListTwo8b:$Vt, GPR64sp:$Rn, XZR) def : InstAlias<asm # "\t$Vt, [$Rn], #" # Offset, - (!cast<Instruction>(NAME # Count # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # Count # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # layout):$Vt, XZR), 1>; @@ -8485,7 +8729,7 @@ multiclass SIMDLdStAliases<string asm, string layout, string Count, // may get mapped to // (LD1Twov8b_POST VecListTwo64:$Vt, GPR64sp:$Rn, XZR) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn], #" # Offset, - (!cast<Instruction>(NAME # Count # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # Count # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # Size):$Vt, XZR), 0>; @@ -8495,7 +8739,7 @@ multiclass SIMDLdStAliases<string asm, string layout, string Count, // may get mapped to // (LD1Twov8b VecListTwo64:$Vt, GPR64sp:$Rn) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn]", - (!cast<Instruction>(NAME # Count # "v" # layout) + (!cast<Instruction>(BaseName # Count # "v" # layout) !cast<RegisterOperand>("VecList" # Count # Size):$Vt, GPR64sp:$Rn), 0>; @@ -8504,14 +8748,14 @@ multiclass SIMDLdStAliases<string asm, string layout, string Count, // may get mapped to // (LD1Twov8b_POST VecListTwo64:$Vt, GPR64sp:$Rn, GPR64pi8:$Xm) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn], $Xm", - (!cast<Instruction>(NAME # Count # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # Count # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # Size):$Vt, !cast<RegisterOperand>("GPR64pi" # Offset):$Xm), 0>; } -multiclass BaseSIMDLdN<string Count, string asm, string veclist, int Offset128, - int Offset64, bits<4> opcode> { +multiclass BaseSIMDLdN<string BaseName, string Count, string asm, string veclist, + int Offset128, int Offset64, bits<4> opcode> { let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in { def v16b: BaseSIMDLdSt<1, 1, opcode, 0b00, asm, (outs !cast<RegisterOperand>(veclist # "16b"):$Vt), @@ -8573,18 +8817,18 @@ multiclass BaseSIMDLdN<string Count, string asm, string veclist, int Offset128, !cast<RegisterOperand>("GPR64pi" # Offset64):$Xm)>; } - defm : SIMDLdStAliases<asm, "16b", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "8h", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "4s", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "2d", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "8b", Count, Offset64, 64>; - defm : SIMDLdStAliases<asm, "4h", Count, Offset64, 64>; - defm : SIMDLdStAliases<asm, "2s", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "16b", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "8h", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "4s", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "2d", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "8b", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "4h", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "2s", Count, Offset64, 64>; } // Only ld1/st1 has a v1d version. -multiclass BaseSIMDStN<string Count, string asm, string veclist, int Offset128, - int Offset64, bits<4> opcode> { +multiclass BaseSIMDStN<string BaseName, string Count, string asm, string veclist, + int Offset128, int Offset64, bits<4> opcode> { let hasSideEffects = 0, mayStore = 1, mayLoad = 0 in { def v16b : BaseSIMDLdSt<1, 0, opcode, 0b00, asm, (outs), (ins !cast<RegisterOperand>(veclist # "16b"):$Vt, @@ -8645,18 +8889,18 @@ multiclass BaseSIMDStN<string Count, string asm, string veclist, int Offset128, !cast<RegisterOperand>("GPR64pi" # Offset64):$Xm)>; } - defm : SIMDLdStAliases<asm, "16b", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "8h", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "4s", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "2d", Count, Offset128, 128>; - defm : SIMDLdStAliases<asm, "8b", Count, Offset64, 64>; - defm : SIMDLdStAliases<asm, "4h", Count, Offset64, 64>; - defm : SIMDLdStAliases<asm, "2s", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "16b", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "8h", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "4s", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "2d", Count, Offset128, 128>; + defm : SIMDLdStAliases<BaseName, asm, "8b", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "4h", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "2s", Count, Offset64, 64>; } -multiclass BaseSIMDLd1<string Count, string asm, string veclist, +multiclass BaseSIMDLd1<string BaseName, string Count, string asm, string veclist, int Offset128, int Offset64, bits<4> opcode> - : BaseSIMDLdN<Count, asm, veclist, Offset128, Offset64, opcode> { + : BaseSIMDLdN<BaseName, Count, asm, veclist, Offset128, Offset64, opcode> { // LD1 instructions have extra "1d" variants. let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in { @@ -8671,12 +8915,12 @@ multiclass BaseSIMDLd1<string Count, string asm, string veclist, !cast<RegisterOperand>("GPR64pi" # Offset64):$Xm)>; } - defm : SIMDLdStAliases<asm, "1d", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "1d", Count, Offset64, 64>; } -multiclass BaseSIMDSt1<string Count, string asm, string veclist, +multiclass BaseSIMDSt1<string BaseName, string Count, string asm, string veclist, int Offset128, int Offset64, bits<4> opcode> - : BaseSIMDStN<Count, asm, veclist, Offset128, Offset64, opcode> { + : BaseSIMDStN<BaseName, Count, asm, veclist, Offset128, Offset64, opcode> { // ST1 instructions have extra "1d" variants. let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in { @@ -8691,45 +8935,45 @@ multiclass BaseSIMDSt1<string Count, string asm, string veclist, !cast<RegisterOperand>("GPR64pi" # Offset64):$Xm)>; } - defm : SIMDLdStAliases<asm, "1d", Count, Offset64, 64>; + defm : SIMDLdStAliases<BaseName, asm, "1d", Count, Offset64, 64>; } multiclass SIMDLd1Multiple<string asm> { - defm One : BaseSIMDLd1<"One", asm, "VecListOne", 16, 8, 0b0111>; - defm Two : BaseSIMDLd1<"Two", asm, "VecListTwo", 32, 16, 0b1010>; - defm Three : BaseSIMDLd1<"Three", asm, "VecListThree", 48, 24, 0b0110>; - defm Four : BaseSIMDLd1<"Four", asm, "VecListFour", 64, 32, 0b0010>; + defm One : BaseSIMDLd1<NAME, "One", asm, "VecListOne", 16, 8, 0b0111>; + defm Two : BaseSIMDLd1<NAME, "Two", asm, "VecListTwo", 32, 16, 0b1010>; + defm Three : BaseSIMDLd1<NAME, "Three", asm, "VecListThree", 48, 24, 0b0110>; + defm Four : BaseSIMDLd1<NAME, "Four", asm, "VecListFour", 64, 32, 0b0010>; } multiclass SIMDSt1Multiple<string asm> { - defm One : BaseSIMDSt1<"One", asm, "VecListOne", 16, 8, 0b0111>; - defm Two : BaseSIMDSt1<"Two", asm, "VecListTwo", 32, 16, 0b1010>; - defm Three : BaseSIMDSt1<"Three", asm, "VecListThree", 48, 24, 0b0110>; - defm Four : BaseSIMDSt1<"Four", asm, "VecListFour", 64, 32, 0b0010>; + defm One : BaseSIMDSt1<NAME, "One", asm, "VecListOne", 16, 8, 0b0111>; + defm Two : BaseSIMDSt1<NAME, "Two", asm, "VecListTwo", 32, 16, 0b1010>; + defm Three : BaseSIMDSt1<NAME, "Three", asm, "VecListThree", 48, 24, 0b0110>; + defm Four : BaseSIMDSt1<NAME, "Four", asm, "VecListFour", 64, 32, 0b0010>; } multiclass SIMDLd2Multiple<string asm> { - defm Two : BaseSIMDLdN<"Two", asm, "VecListTwo", 32, 16, 0b1000>; + defm Two : BaseSIMDLdN<NAME, "Two", asm, "VecListTwo", 32, 16, 0b1000>; } multiclass SIMDSt2Multiple<string asm> { - defm Two : BaseSIMDStN<"Two", asm, "VecListTwo", 32, 16, 0b1000>; + defm Two : BaseSIMDStN<NAME, "Two", asm, "VecListTwo", 32, 16, 0b1000>; } multiclass SIMDLd3Multiple<string asm> { - defm Three : BaseSIMDLdN<"Three", asm, "VecListThree", 48, 24, 0b0100>; + defm Three : BaseSIMDLdN<NAME, "Three", asm, "VecListThree", 48, 24, 0b0100>; } multiclass SIMDSt3Multiple<string asm> { - defm Three : BaseSIMDStN<"Three", asm, "VecListThree", 48, 24, 0b0100>; + defm Three : BaseSIMDStN<NAME, "Three", asm, "VecListThree", 48, 24, 0b0100>; } multiclass SIMDLd4Multiple<string asm> { - defm Four : BaseSIMDLdN<"Four", asm, "VecListFour", 64, 32, 0b0000>; + defm Four : BaseSIMDLdN<NAME, "Four", asm, "VecListFour", 64, 32, 0b0000>; } multiclass SIMDSt4Multiple<string asm> { - defm Four : BaseSIMDStN<"Four", asm, "VecListFour", 64, 32, 0b0000>; + defm Four : BaseSIMDStN<NAME, "Four", asm, "VecListFour", 64, 32, 0b0000>; } //--- @@ -8769,7 +9013,7 @@ class BaseSIMDLdStSingleTied<bit L, bit R, bits<3> opcode, let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in class BaseSIMDLdR<bit Q, bit R, bits<3> opcode, bit S, bits<2> size, string asm, - Operand listtype> + DAGOperand listtype> : BaseSIMDLdStSingle<1, R, opcode, asm, "\t$Vt, [$Rn]", "", (outs listtype:$Vt), (ins GPR64sp:$Rn), []> { @@ -8781,7 +9025,7 @@ class BaseSIMDLdR<bit Q, bit R, bits<3> opcode, bit S, bits<2> size, string asm, } let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in class BaseSIMDLdRPost<bit Q, bit R, bits<3> opcode, bit S, bits<2> size, - string asm, Operand listtype, Operand GPR64pi> + string asm, DAGOperand listtype, DAGOperand GPR64pi> : BaseSIMDLdStSingle<1, R, opcode, asm, "\t$Vt, [$Rn], $Xm", "$Rn = $wback", (outs GPR64sp:$wback, listtype:$Vt), @@ -8794,14 +9038,14 @@ class BaseSIMDLdRPost<bit Q, bit R, bits<3> opcode, bit S, bits<2> size, let Inst{11-10} = size; } -multiclass SIMDLdrAliases<string asm, string layout, string Count, +multiclass SIMDLdrAliases<string BaseName, string asm, string layout, string Count, int Offset, int Size> { // E.g. "ld1r { v0.8b }, [x1], #1" // "ld1r.8b\t$Vt, [$Rn], #1" // may get mapped to // (LD1Rv8b_POST VecListOne8b:$Vt, GPR64sp:$Rn, XZR) def : InstAlias<asm # "\t$Vt, [$Rn], #" # Offset, - (!cast<Instruction>(NAME # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # layout):$Vt, XZR), 1>; @@ -8811,7 +9055,7 @@ multiclass SIMDLdrAliases<string asm, string layout, string Count, // may get mapped to // (LD1Rv8b_POST VecListOne64:$Vt, GPR64sp:$Rn, XZR) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn], #" # Offset, - (!cast<Instruction>(NAME # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # Size):$Vt, XZR), 0>; @@ -8821,7 +9065,7 @@ multiclass SIMDLdrAliases<string asm, string layout, string Count, // may get mapped to // (LD1Rv8b VecListOne64:$Vt, GPR64sp:$Rn) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn]", - (!cast<Instruction>(NAME # "v" # layout) + (!cast<Instruction>(BaseName # "v" # layout) !cast<RegisterOperand>("VecList" # Count # Size):$Vt, GPR64sp:$Rn), 0>; @@ -8830,7 +9074,7 @@ multiclass SIMDLdrAliases<string asm, string layout, string Count, // may get mapped to // (LD1Rv8b_POST VecListOne64:$Vt, GPR64sp:$Rn, GPR64pi1:$Xm) def : InstAlias<asm # "." # layout # "\t$Vt, [$Rn], $Xm", - (!cast<Instruction>(NAME # "v" # layout # "_POST") + (!cast<Instruction>(BaseName # "v" # layout # "_POST") GPR64sp:$Rn, !cast<RegisterOperand>("VecList" # Count # Size):$Vt, !cast<RegisterOperand>("GPR64pi" # Offset):$Xm), 0>; @@ -8839,55 +9083,55 @@ multiclass SIMDLdrAliases<string asm, string layout, string Count, multiclass SIMDLdR<bit R, bits<3> opcode, bit S, string asm, string Count, int Offset1, int Offset2, int Offset4, int Offset8> { def v8b : BaseSIMDLdR<0, R, opcode, S, 0b00, asm, - !cast<Operand>("VecList" # Count # "8b")>; + !cast<DAGOperand>("VecList" # Count # "8b")>; def v16b: BaseSIMDLdR<1, R, opcode, S, 0b00, asm, - !cast<Operand>("VecList" # Count #"16b")>; + !cast<DAGOperand>("VecList" # Count #"16b")>; def v4h : BaseSIMDLdR<0, R, opcode, S, 0b01, asm, - !cast<Operand>("VecList" # Count #"4h")>; + !cast<DAGOperand>("VecList" # Count #"4h")>; def v8h : BaseSIMDLdR<1, R, opcode, S, 0b01, asm, - !cast<Operand>("VecList" # Count #"8h")>; + !cast<DAGOperand>("VecList" # Count #"8h")>; def v2s : BaseSIMDLdR<0, R, opcode, S, 0b10, asm, - !cast<Operand>("VecList" # Count #"2s")>; + !cast<DAGOperand>("VecList" # Count #"2s")>; def v4s : BaseSIMDLdR<1, R, opcode, S, 0b10, asm, - !cast<Operand>("VecList" # Count #"4s")>; + !cast<DAGOperand>("VecList" # Count #"4s")>; def v1d : BaseSIMDLdR<0, R, opcode, S, 0b11, asm, - !cast<Operand>("VecList" # Count #"1d")>; + !cast<DAGOperand>("VecList" # Count #"1d")>; def v2d : BaseSIMDLdR<1, R, opcode, S, 0b11, asm, - !cast<Operand>("VecList" # Count #"2d")>; + !cast<DAGOperand>("VecList" # Count #"2d")>; def v8b_POST : BaseSIMDLdRPost<0, R, opcode, S, 0b00, asm, - !cast<Operand>("VecList" # Count # "8b"), - !cast<Operand>("GPR64pi" # Offset1)>; + !cast<DAGOperand>("VecList" # Count # "8b"), + !cast<DAGOperand>("GPR64pi" # Offset1)>; def v16b_POST: BaseSIMDLdRPost<1, R, opcode, S, 0b00, asm, - !cast<Operand>("VecList" # Count # "16b"), - !cast<Operand>("GPR64pi" # Offset1)>; + !cast<DAGOperand>("VecList" # Count # "16b"), + !cast<DAGOperand>("GPR64pi" # Offset1)>; def v4h_POST : BaseSIMDLdRPost<0, R, opcode, S, 0b01, asm, - !cast<Operand>("VecList" # Count # "4h"), - !cast<Operand>("GPR64pi" # Offset2)>; + !cast<DAGOperand>("VecList" # Count # "4h"), + !cast<DAGOperand>("GPR64pi" # Offset2)>; def v8h_POST : BaseSIMDLdRPost<1, R, opcode, S, 0b01, asm, - !cast<Operand>("VecList" # Count # "8h"), - !cast<Operand>("GPR64pi" # Offset2)>; + !cast<DAGOperand>("VecList" # Count # "8h"), + !cast<DAGOperand>("GPR64pi" # Offset2)>; def v2s_POST : BaseSIMDLdRPost<0, R, opcode, S, 0b10, asm, - !cast<Operand>("VecList" # Count # "2s"), - !cast<Operand>("GPR64pi" # Offset4)>; + !cast<DAGOperand>("VecList" # Count # "2s"), + !cast<DAGOperand>("GPR64pi" # Offset4)>; def v4s_POST : BaseSIMDLdRPost<1, R, opcode, S, 0b10, asm, - !cast<Operand>("VecList" # Count # "4s"), - !cast<Operand>("GPR64pi" # Offset4)>; + !cast<DAGOperand>("VecList" # Count # "4s"), + !cast<DAGOperand>("GPR64pi" # Offset4)>; def v1d_POST : BaseSIMDLdRPost<0, R, opcode, S, 0b11, asm, - !cast<Operand>("VecList" # Count # "1d"), - !cast<Operand>("GPR64pi" # Offset8)>; + !cast<DAGOperand>("VecList" # Count # "1d"), + !cast<DAGOperand>("GPR64pi" # Offset8)>; def v2d_POST : BaseSIMDLdRPost<1, R, opcode, S, 0b11, asm, - !cast<Operand>("VecList" # Count # "2d"), - !cast<Operand>("GPR64pi" # Offset8)>; + !cast<DAGOperand>("VecList" # Count # "2d"), + !cast<DAGOperand>("GPR64pi" # Offset8)>; - defm : SIMDLdrAliases<asm, "8b", Count, Offset1, 64>; - defm : SIMDLdrAliases<asm, "16b", Count, Offset1, 128>; - defm : SIMDLdrAliases<asm, "4h", Count, Offset2, 64>; - defm : SIMDLdrAliases<asm, "8h", Count, Offset2, 128>; - defm : SIMDLdrAliases<asm, "2s", Count, Offset4, 64>; - defm : SIMDLdrAliases<asm, "4s", Count, Offset4, 128>; - defm : SIMDLdrAliases<asm, "1d", Count, Offset8, 64>; - defm : SIMDLdrAliases<asm, "2d", Count, Offset8, 128>; + defm : SIMDLdrAliases<NAME, asm, "8b", Count, Offset1, 64>; + defm : SIMDLdrAliases<NAME, asm, "16b", Count, Offset1, 128>; + defm : SIMDLdrAliases<NAME, asm, "4h", Count, Offset2, 64>; + defm : SIMDLdrAliases<NAME, asm, "8h", Count, Offset2, 128>; + defm : SIMDLdrAliases<NAME, asm, "2s", Count, Offset4, 64>; + defm : SIMDLdrAliases<NAME, asm, "4s", Count, Offset4, 128>; + defm : SIMDLdrAliases<NAME, asm, "1d", Count, Offset8, 64>; + defm : SIMDLdrAliases<NAME, asm, "2d", Count, Offset8, 128>; } class SIMDLdStSingleB<bit L, bit R, bits<3> opcode, string asm, @@ -9245,31 +9489,31 @@ multiclass SIMDLdStSingleAliases<string asm, string layout, string Type, } multiclass SIMDLdSt1SingleAliases<string asm> { - defm : SIMDLdStSingleAliases<asm, "b", "i8", "One", 1, VectorIndexB>; - defm : SIMDLdStSingleAliases<asm, "h", "i16", "One", 2, VectorIndexH>; - defm : SIMDLdStSingleAliases<asm, "s", "i32", "One", 4, VectorIndexS>; - defm : SIMDLdStSingleAliases<asm, "d", "i64", "One", 8, VectorIndexD>; + defm "" : SIMDLdStSingleAliases<asm, "b", "i8", "One", 1, VectorIndexB>; + defm "" : SIMDLdStSingleAliases<asm, "h", "i16", "One", 2, VectorIndexH>; + defm "" : SIMDLdStSingleAliases<asm, "s", "i32", "One", 4, VectorIndexS>; + defm "" : SIMDLdStSingleAliases<asm, "d", "i64", "One", 8, VectorIndexD>; } multiclass SIMDLdSt2SingleAliases<string asm> { - defm : SIMDLdStSingleAliases<asm, "b", "i8", "Two", 2, VectorIndexB>; - defm : SIMDLdStSingleAliases<asm, "h", "i16", "Two", 4, VectorIndexH>; - defm : SIMDLdStSingleAliases<asm, "s", "i32", "Two", 8, VectorIndexS>; - defm : SIMDLdStSingleAliases<asm, "d", "i64", "Two", 16, VectorIndexD>; + defm "" : SIMDLdStSingleAliases<asm, "b", "i8", "Two", 2, VectorIndexB>; + defm "" : SIMDLdStSingleAliases<asm, "h", "i16", "Two", 4, VectorIndexH>; + defm "" : SIMDLdStSingleAliases<asm, "s", "i32", "Two", 8, VectorIndexS>; + defm "" : SIMDLdStSingleAliases<asm, "d", "i64", "Two", 16, VectorIndexD>; } multiclass SIMDLdSt3SingleAliases<string asm> { - defm : SIMDLdStSingleAliases<asm, "b", "i8", "Three", 3, VectorIndexB>; - defm : SIMDLdStSingleAliases<asm, "h", "i16", "Three", 6, VectorIndexH>; - defm : SIMDLdStSingleAliases<asm, "s", "i32", "Three", 12, VectorIndexS>; - defm : SIMDLdStSingleAliases<asm, "d", "i64", "Three", 24, VectorIndexD>; + defm "" : SIMDLdStSingleAliases<asm, "b", "i8", "Three", 3, VectorIndexB>; + defm "" : SIMDLdStSingleAliases<asm, "h", "i16", "Three", 6, VectorIndexH>; + defm "" : SIMDLdStSingleAliases<asm, "s", "i32", "Three", 12, VectorIndexS>; + defm "" : SIMDLdStSingleAliases<asm, "d", "i64", "Three", 24, VectorIndexD>; } multiclass SIMDLdSt4SingleAliases<string asm> { - defm : SIMDLdStSingleAliases<asm, "b", "i8", "Four", 4, VectorIndexB>; - defm : SIMDLdStSingleAliases<asm, "h", "i16", "Four", 8, VectorIndexH>; - defm : SIMDLdStSingleAliases<asm, "s", "i32", "Four", 16, VectorIndexS>; - defm : SIMDLdStSingleAliases<asm, "d", "i64", "Four", 32, VectorIndexD>; + defm "" : SIMDLdStSingleAliases<asm, "b", "i8", "Four", 4, VectorIndexB>; + defm "" : SIMDLdStSingleAliases<asm, "h", "i16", "Four", 8, VectorIndexH>; + defm "" : SIMDLdStSingleAliases<asm, "s", "i32", "Four", 16, VectorIndexS>; + defm "" : SIMDLdStSingleAliases<asm, "d", "i64", "Four", 32, VectorIndexD>; } } // end of 'let Predicates = [HasNEON]' @@ -9280,9 +9524,9 @@ multiclass SIMDLdSt4SingleAliases<string asm> { let Predicates = [HasNEON, HasRDM] in { class BaseSIMDThreeSameVectorTiedR0<bit Q, bit U, bits<2> size, bits<5> opcode, - RegisterOperand regtype, string asm, + RegisterOperand regtype, string asm, string kind, list<dag> pattern> - : BaseSIMDThreeSameVectorTied<Q, U, {size,0}, opcode, regtype, asm, kind, + : BaseSIMDThreeSameVectorTied<Q, U, {size,0}, opcode, regtype, asm, kind, pattern> { } multiclass SIMDThreeSameVectorSQRDMLxHTiedHS<bit U, bits<5> opc, string asm, @@ -9291,7 +9535,7 @@ multiclass SIMDThreeSameVectorSQRDMLxHTiedHS<bit U, bits<5> opc, string asm, [(set (v4i16 V64:$dst), (Accum (v4i16 V64:$Rd), (v4i16 (int_aarch64_neon_sqrdmulh (v4i16 V64:$Rn), - (v4i16 V64:$Rm)))))]>; + (v4i16 V64:$Rm)))))]>; def v8i16 : BaseSIMDThreeSameVectorTiedR0<1, U, 0b01, opc, V128, asm, ".8h", [(set (v8i16 V128:$dst), (Accum (v8i16 V128:$Rd), @@ -9355,28 +9599,28 @@ multiclass SIMDIndexedSQRDMLxHSDTied<bit U, bits<4> opc, string asm, let Inst{21} = idx{0}; } - // FIXME: it would be nice to use the scalar (v1i32) instruction here, but + // FIXME: it would be nice to use the scalar (v1i32) instruction here, but // an intermediate EXTRACT_SUBREG would be untyped. - // FIXME: direct EXTRACT_SUBREG from v2i32 to i32 is illegal, that's why we + // FIXME: direct EXTRACT_SUBREG from v2i32 to i32 is illegal, that's why we // got it lowered here as (i32 vector_extract (v4i32 insert_subvector(..))) def : Pat<(i32 (Accum (i32 FPR32Op:$Rd), - (i32 (vector_extract + (i32 (vector_extract (v4i32 (insert_subvector - (undef), - (v2i32 (int_aarch64_neon_sqrdmulh + (undef), + (v2i32 (int_aarch64_neon_sqrdmulh (v2i32 V64:$Rn), - (v2i32 (AArch64duplane32 + (v2i32 (AArch64duplane32 (v4i32 V128:$Rm), VectorIndexS:$idx)))), (i32 0))), (i64 0))))), (EXTRACT_SUBREG (v2i32 (!cast<Instruction>(NAME # v2i32_indexed) - (v2i32 (INSERT_SUBREG (v2i32 (IMPLICIT_DEF)), - FPR32Op:$Rd, - ssub)), + (v2i32 (INSERT_SUBREG (v2i32 (IMPLICIT_DEF)), + FPR32Op:$Rd, + ssub)), V64:$Rn, - V128:$Rm, + V128:$Rm, VectorIndexS:$idx)), ssub)>; @@ -9397,26 +9641,26 @@ multiclass SIMDIndexedSQRDMLxHSDTied<bit U, bits<4> opc, string asm, // FIXME: it would be nice to use the scalar (v1i32) instruction here, but // an intermediate EXTRACT_SUBREG would be untyped. def : Pat<(i32 (Accum (i32 FPR32Op:$Rd), - (i32 (vector_extract - (v4i32 (int_aarch64_neon_sqrdmulh + (i32 (vector_extract + (v4i32 (int_aarch64_neon_sqrdmulh (v4i32 V128:$Rn), - (v4i32 (AArch64duplane32 + (v4i32 (AArch64duplane32 (v4i32 V128:$Rm), VectorIndexS:$idx)))), (i64 0))))), (EXTRACT_SUBREG (v4i32 (!cast<Instruction>(NAME # v4i32_indexed) - (v4i32 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)), - FPR32Op:$Rd, - ssub)), + (v4i32 (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)), + FPR32Op:$Rd, + ssub)), V128:$Rn, - V128:$Rm, + V128:$Rm, VectorIndexS:$idx)), ssub)>; def i16_indexed : BaseSIMDIndexedTied<1, U, 1, 0b01, opc, FPR16Op, FPR16Op, V128_lo, - VectorIndexH, asm, ".h", "", "", ".h", + VectorIndexH, asm, ".h", "", "", ".h", []> { bits<3> idx; let Inst{11} = idx{2}; @@ -9676,7 +9920,6 @@ multiclass SIMDIndexedTiedComplexHSD<bit U, bit opc1, bit opc2, Operand rottype, // Crypto extensions //---------------------------------------------------------------------------- -let Predicates = [HasCrypto] in { let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in class AESBase<bits<4> opc, string asm, dag outs, dag ins, string cstr, list<dag> pat> @@ -9766,7 +10009,103 @@ class SHATiedInstVV<bits<4> opc, string asm, Intrinsic OpNode> class SHAInstSS<bits<4> opc, string asm, Intrinsic OpNode> : SHA2OpInst<opc, asm, "", "", (outs FPR32:$Rd), (ins FPR32:$Rn), [(set (i32 FPR32:$Rd), (OpNode (i32 FPR32:$Rn)))]>; -} // end of 'let Predicates = [HasCrypto]' + +// Armv8.2-A Crypto extensions +class BaseCryptoV82<dag oops, dag iops, string asm, string asmops, string cst, + list<dag> pattern> + : I <oops, iops, asm, asmops, cst, pattern>, Sched<[WriteV]> { + bits<5> Vd; + bits<5> Vn; + let Inst{31-25} = 0b1100111; + let Inst{9-5} = Vn; + let Inst{4-0} = Vd; +} + +class CryptoRRTied<bits<1>op0, bits<2>op1, string asm, string asmops> + : BaseCryptoV82<(outs V128:$Vd), (ins V128:$Vn, V128:$Vm), asm, asmops, + "$Vm = $Vd", []> { + let Inst{31-25} = 0b1100111; + let Inst{24-21} = 0b0110; + let Inst{20-15} = 0b000001; + let Inst{14} = op0; + let Inst{13-12} = 0b00; + let Inst{11-10} = op1; +} +class CryptoRRTied_2D<bits<1>op0, bits<2>op1, string asm> + : CryptoRRTied<op0, op1, asm, "{\t$Vd.2d, $Vn.2d}">; +class CryptoRRTied_4S<bits<1>op0, bits<2>op1, string asm> + : CryptoRRTied<op0, op1, asm, "{\t$Vd.4s, $Vn.4s}">; + +class CryptoRRR<bits<1> op0, bits<2>op1, dag oops, dag iops, string asm, + string asmops, string cst> + : BaseCryptoV82<oops, iops, asm , asmops, cst, []> { + bits<5> Vm; + let Inst{24-21} = 0b0011; + let Inst{20-16} = Vm; + let Inst{15} = 0b1; + let Inst{14} = op0; + let Inst{13-12} = 0b00; + let Inst{11-10} = op1; +} +class CryptoRRR_2D<bits<1> op0, bits<2>op1, string asm> + : CryptoRRR<op0, op1, (outs V128:$Vd), (ins V128:$Vn, V128:$Vm), asm, + "{\t$Vd.2d, $Vn.2d, $Vm.2d}", "">; +class CryptoRRRTied_2D<bits<1> op0, bits<2>op1, string asm> + : CryptoRRR<op0, op1, (outs V128:$Vdst), (ins V128:$Vd, V128:$Vn, V128:$Vm), asm, + "{\t$Vd.2d, $Vn.2d, $Vm.2d}", "$Vd = $Vdst">; +class CryptoRRR_4S<bits<1> op0, bits<2>op1, string asm> + : CryptoRRR<op0, op1, (outs V128:$Vd), (ins V128:$Vn, V128:$Vm), asm, + "{\t$Vd.4s, $Vn.4s, $Vm.4s}", "">; +class CryptoRRRTied_4S<bits<1> op0, bits<2>op1, string asm> + : CryptoRRR<op0, op1, (outs V128:$Vdst), (ins V128:$Vd, V128:$Vn, V128:$Vm), asm, + "{\t$Vd.4s, $Vn.4s, $Vm.4s}", "$Vd = $Vdst">; +class CryptoRRRTied<bits<1> op0, bits<2>op1, string asm> + : CryptoRRR<op0, op1, (outs FPR128:$Vdst), (ins FPR128:$Vd, FPR128:$Vn, V128:$Vm), + asm, "{\t$Vd, $Vn, $Vm.2d}", "$Vd = $Vdst">; + +class CryptoRRRR<bits<2>op0, string asm, string asmops> + : BaseCryptoV82<(outs V128:$Vd), (ins V128:$Vn, V128:$Vm, V128:$Va), asm, + asmops, "", []> { + bits<5> Vm; + bits<5> Va; + let Inst{24-23} = 0b00; + let Inst{22-21} = op0; + let Inst{20-16} = Vm; + let Inst{15} = 0b0; + let Inst{14-10} = Va; +} +class CryptoRRRR_16B<bits<2>op0, string asm> + : CryptoRRRR<op0, asm, "{\t$Vd.16b, $Vn.16b, $Vm.16b, $Va.16b}"> { +} +class CryptoRRRR_4S<bits<2>op0, string asm> + : CryptoRRRR<op0, asm, "{\t$Vd.4s, $Vn.4s, $Vm.4s, $Va.4s}"> { +} + +class CryptoRRRi6<string asm> + : BaseCryptoV82<(outs V128:$Vd), (ins V128:$Vn, V128:$Vm, uimm6:$imm), asm, + "{\t$Vd.2d, $Vn.2d, $Vm.2d, $imm}", "", []> { + bits<6> imm; + bits<5> Vm; + let Inst{24-21} = 0b0100; + let Inst{20-16} = Vm; + let Inst{15-10} = imm; + let Inst{9-5} = Vn; + let Inst{4-0} = Vd; +} + +class CryptoRRRi2Tied<bits<1>op0, bits<2>op1, string asm> + : BaseCryptoV82<(outs V128:$Vdst), + (ins V128:$Vd, V128:$Vn, V128:$Vm, VectorIndexS:$imm), + asm, "{\t$Vd.4s, $Vn.4s, $Vm.s$imm}", "$Vd = $Vdst", []> { + bits<2> imm; + bits<5> Vm; + let Inst{24-21} = 0b0010; + let Inst{20-16} = Vm; + let Inst{15} = 0b1; + let Inst{14} = op0; + let Inst{13-12} = imm; + let Inst{11-10} = op1; +} //---------------------------------------------------------------------------- // v8.1 atomic instructions extension: @@ -9910,7 +10249,7 @@ class BaseLDOPregister<string op, string order, string size, RegisterClass RC> let Predicates = [HasLSE]; } -multiclass LDOPregister<bits<3> opc, string op, bits<1> Acq, bits<1> Rel, +multiclass LDOPregister<bits<3> opc, string op, bits<1> Acq, bits<1> Rel, string order> { let Sz = 0b00, Acq = Acq, Rel = Rel, opc = opc in def B : BaseLDOPregister<op, order, "b", GPR32>; @@ -9927,15 +10266,15 @@ multiclass LDOPregister<bits<3> opc, string op, bits<1> Acq, bits<1> Rel, let Predicates = [HasLSE] in multiclass LDOPregister_patterns_ord_dag<string inst, string suffix, string op, string size, dag SrcRHS, dag DstRHS> { - def : Pat<(!cast<SDNode>(op#"_"#size#"_monotonic") GPR64sp:$Rn, SrcRHS), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_monotonic") GPR64sp:$Rn, SrcRHS), (!cast<Instruction>(inst # suffix) DstRHS, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_acquire") GPR64sp:$Rn, SrcRHS), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_acquire") GPR64sp:$Rn, SrcRHS), (!cast<Instruction>(inst # "A" # suffix) DstRHS, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_release") GPR64sp:$Rn, SrcRHS), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_release") GPR64sp:$Rn, SrcRHS), (!cast<Instruction>(inst # "L" # suffix) DstRHS, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_acq_rel") GPR64sp:$Rn, SrcRHS), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_acq_rel") GPR64sp:$Rn, SrcRHS), (!cast<Instruction>(inst # "AL" # suffix) DstRHS, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_seq_cst") GPR64sp:$Rn, SrcRHS), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_seq_cst") GPR64sp:$Rn, SrcRHS), (!cast<Instruction>(inst # "AL" # suffix) DstRHS, GPR64sp:$Rn)>; } @@ -9974,15 +10313,15 @@ multiclass LDOPregister_patterns_mod<string inst, string op, string mod> { let Predicates = [HasLSE] in multiclass CASregister_patterns_ord_dag<string inst, string suffix, string op, string size, dag OLD, dag NEW> { - def : Pat<(!cast<SDNode>(op#"_"#size#"_monotonic") GPR64sp:$Rn, OLD, NEW), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_monotonic") GPR64sp:$Rn, OLD, NEW), (!cast<Instruction>(inst # suffix) OLD, NEW, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_acquire") GPR64sp:$Rn, OLD, NEW), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_acquire") GPR64sp:$Rn, OLD, NEW), (!cast<Instruction>(inst # "A" # suffix) OLD, NEW, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_release") GPR64sp:$Rn, OLD, NEW), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_release") GPR64sp:$Rn, OLD, NEW), (!cast<Instruction>(inst # "L" # suffix) OLD, NEW, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_acq_rel") GPR64sp:$Rn, OLD, NEW), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_acq_rel") GPR64sp:$Rn, OLD, NEW), (!cast<Instruction>(inst # "AL" # suffix) OLD, NEW, GPR64sp:$Rn)>; - def : Pat<(!cast<SDNode>(op#"_"#size#"_seq_cst") GPR64sp:$Rn, OLD, NEW), + def : Pat<(!cast<PatFrag>(op#"_"#size#"_seq_cst") GPR64sp:$Rn, OLD, NEW), (!cast<Instruction>(inst # "AL" # suffix) OLD, NEW, GPR64sp:$Rn)>; } |