Index: lib/Target/AArch64/AArch64RegisterInfo.td =================================================================== --- lib/Target/AArch64/AArch64RegisterInfo.td +++ lib/Target/AArch64/AArch64RegisterInfo.td @@ -489,13 +489,13 @@ let ParserMatchClass = VectorRegLoAsmOperand; } -class TypedVecListAsmOperand +class TypedVecListAsmOperand : AsmOperandClass { let Name = "TypedVectorList" # count # "_" # lanes # eltsize; let PredicateMethod = "isTypedVectorList"; - let RenderMethod = "addVectorList" # regsize # "Operands<" # count # ">"; + let RenderMethod = "addVectorListOperands<" # vecty # ", " # count # ">"; } class TypedVecListRegOperand @@ -507,7 +507,7 @@ def _64AsmOperand : AsmOperandClass { let Name = NAME # "64"; let PredicateMethod = "isImplicitlyTypedVectorList"; - let RenderMethod = "addVectorList64Operands<" # count # ">"; + let RenderMethod = "addVectorListOperands"; } def "64" : RegisterOperand { @@ -517,7 +517,7 @@ def _128AsmOperand : AsmOperandClass { let Name = NAME # "128"; let PredicateMethod = "isImplicitlyTypedVectorList"; - let RenderMethod = "addVectorList128Operands<" # count # ">"; + let RenderMethod = "addVectorListOperands"; } def "128" : RegisterOperand { @@ -527,25 +527,25 @@ // 64-bit register lists with explicit type. // { v0.8b, v1.8b } - def _8bAsmOperand : TypedVecListAsmOperand; + def _8bAsmOperand : TypedVecListAsmOperand; def "8b" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_8bAsmOperand"); } // { v0.4h, v1.4h } - def _4hAsmOperand : TypedVecListAsmOperand; + def _4hAsmOperand : TypedVecListAsmOperand; def "4h" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_4hAsmOperand"); } // { v0.2s, v1.2s } - def _2sAsmOperand : TypedVecListAsmOperand; + def _2sAsmOperand : TypedVecListAsmOperand; def "2s" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_2sAsmOperand"); } // { v0.1d, v1.1d } - def _1dAsmOperand : TypedVecListAsmOperand; + def _1dAsmOperand : TypedVecListAsmOperand; def "1d" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_1dAsmOperand"); } @@ -553,49 +553,49 @@ // 128-bit register lists with explicit type // { v0.16b, v1.16b } - def _16bAsmOperand : TypedVecListAsmOperand; + def _16bAsmOperand : TypedVecListAsmOperand; def "16b" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_16bAsmOperand"); } // { v0.8h, v1.8h } - def _8hAsmOperand : TypedVecListAsmOperand; + def _8hAsmOperand : TypedVecListAsmOperand; def "8h" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_8hAsmOperand"); } // { v0.4s, v1.4s } - def _4sAsmOperand : TypedVecListAsmOperand; + def _4sAsmOperand : TypedVecListAsmOperand; def "4s" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_4sAsmOperand"); } // { v0.2d, v1.2d } - def _2dAsmOperand : TypedVecListAsmOperand; + def _2dAsmOperand : TypedVecListAsmOperand; def "2d" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_2dAsmOperand"); } // { v0.b, v1.b } - def _bAsmOperand : TypedVecListAsmOperand; + def _bAsmOperand : TypedVecListAsmOperand; def "b" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_bAsmOperand"); } // { v0.h, v1.h } - def _hAsmOperand : TypedVecListAsmOperand; + def _hAsmOperand : TypedVecListAsmOperand; def "h" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_hAsmOperand"); } // { v0.s, v1.s } - def _sAsmOperand : TypedVecListAsmOperand; + def _sAsmOperand : TypedVecListAsmOperand; def "s" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_sAsmOperand"); } // { v0.d, v1.d } - def _dAsmOperand : TypedVecListAsmOperand; + def _dAsmOperand : TypedVecListAsmOperand; def "d" : TypedVecListRegOperand { let ParserMatchClass = !cast(NAME # "_dAsmOperand"); } Index: lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp =================================================================== --- lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -1136,30 +1136,26 @@ Inst.addOperand(MCOperand::createReg(getReg())); } - template - void addVectorList64Operands(MCInst &Inst, unsigned N) const { - assert(N == 1 && "Invalid number of operands!"); - static const unsigned FirstRegs[] = { AArch64::D0, - AArch64::D0_D1, - AArch64::D0_D1_D2, - AArch64::D0_D1_D2_D3 }; - unsigned FirstReg = FirstRegs[NumRegs - 1]; - - Inst.addOperand( - MCOperand::createReg(FirstReg + getVectorListStart() - AArch64::Q0)); - } + enum VecListIndexType { + VecListIdx_DReg = 0, + VecListIdx_QReg = 1, + }; - template - void addVectorList128Operands(MCInst &Inst, unsigned N) const { + template + void addVectorListOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); - static const unsigned FirstRegs[] = { AArch64::Q0, - AArch64::Q0_Q1, - AArch64::Q0_Q1_Q2, - AArch64::Q0_Q1_Q2_Q3 }; - unsigned FirstReg = FirstRegs[NumRegs - 1]; - - Inst.addOperand( - MCOperand::createReg(FirstReg + getVectorListStart() - AArch64::Q0)); + static const unsigned FirstRegs[][5] = { + /* DReg */ { AArch64::Q0, + AArch64::D0, AArch64::D0_D1, + AArch64::D0_D1_D2, AArch64::D0_D1_D2_D3 }, + /* QReg */ { AArch64::Q0, + AArch64::Q0, AArch64::Q0_Q1, + AArch64::Q0_Q1_Q2, AArch64::Q0_Q1_Q2_Q3 } + }; + + unsigned FirstReg = FirstRegs[(unsigned)RegTy][NumRegs]; + Inst.addOperand(MCOperand::createReg(FirstReg + getVectorListStart() - + FirstRegs[(unsigned)RegTy][0])); } void addVectorIndex1Operands(MCInst &Inst, unsigned N) const {