@@ -151,6 +151,9 @@ class MipsAsmParser : public MCTargetAsmParser {
151
151
MipsAsmParser::OperandMatchResultTy
152
152
parseRegisterPair (OperandVector &Operands);
153
153
154
+ MipsAsmParser::OperandMatchResultTy
155
+ parseMovePRegPair (OperandVector &Operands);
156
+
154
157
MipsAsmParser::OperandMatchResultTy
155
158
parseRegisterList (OperandVector &Operands);
156
159
@@ -683,6 +686,11 @@ class MipsOperand : public MCParsedAsmOperand {
683
686
Inst.addOperand (MCOperand::CreateReg (getGPRMM16Reg ()));
684
687
}
685
688
689
+ void addGPRMM16AsmRegMovePOperands (MCInst &Inst, unsigned N) const {
690
+ assert (N == 1 && " Invalid number of operands!" );
691
+ Inst.addOperand (MCOperand::CreateReg (getGPRMM16Reg ()));
692
+ }
693
+
686
694
// / Render the operand to an MCInst as a GPR64
687
695
// / Asserts if the wrong number of operands are requested, or the operand
688
696
// / is not a k_RegisterIndex compatible with RegKind_GPR
@@ -803,6 +811,12 @@ class MipsOperand : public MCParsedAsmOperand {
803
811
Inst.addOperand (MCOperand::CreateReg (RegNo));
804
812
}
805
813
814
+ void addMovePRegPairOperands (MCInst &Inst, unsigned N) const {
815
+ assert (N == 2 && " Invalid number of operands!" );
816
+ for (auto RegNo : getRegList ())
817
+ Inst.addOperand (MCOperand::CreateReg (RegNo));
818
+ }
819
+
806
820
bool isReg () const override {
807
821
// As a special case until we sort out the definition of div/divu, pretend
808
822
// that $0/$zero are k_PhysRegister so that MCK_ZERO works correctly.
@@ -867,6 +881,25 @@ class MipsOperand : public MCParsedAsmOperand {
867
881
return 1 <= Val && Val <= 4 ;
868
882
}
869
883
bool isRegList () const { return Kind == k_RegList; }
884
+ bool isMovePRegPair () const {
885
+ if (Kind != k_RegList || RegList.List ->size () != 2 )
886
+ return false ;
887
+
888
+ unsigned R0 = RegList.List ->front ();
889
+ unsigned R1 = RegList.List ->back ();
890
+
891
+ if ((R0 == Mips::A1 && R1 == Mips::A2) ||
892
+ (R0 == Mips::A1 && R1 == Mips::A3) ||
893
+ (R0 == Mips::A2 && R1 == Mips::A3) ||
894
+ (R0 == Mips::A0 && R1 == Mips::S5) ||
895
+ (R0 == Mips::A0 && R1 == Mips::S6) ||
896
+ (R0 == Mips::A0 && R1 == Mips::A1) ||
897
+ (R0 == Mips::A0 && R1 == Mips::A2) ||
898
+ (R0 == Mips::A0 && R1 == Mips::A3))
899
+ return true ;
900
+
901
+ return false ;
902
+ }
870
903
871
904
StringRef getToken () const {
872
905
assert (Kind == k_Token && " Invalid access!" );
@@ -1053,6 +1086,12 @@ class MipsOperand : public MCParsedAsmOperand {
1053
1086
(RegIdx.Index >= 2 && RegIdx.Index <= 7 ) ||
1054
1087
RegIdx.Index == 17 );
1055
1088
}
1089
+ bool isMM16AsmRegMoveP () const {
1090
+ if (!(isRegIdx () && RegIdx.Kind ))
1091
+ return false ;
1092
+ return (RegIdx.Index == 0 || (RegIdx.Index >= 2 && RegIdx.Index <= 3 ) ||
1093
+ (RegIdx.Index >= 16 && RegIdx.Index <= 20 ));
1094
+ }
1056
1095
bool isFGRAsmReg () const {
1057
1096
// AFGR64 is $0-$15 but we handle this in getAFGR64()
1058
1097
return isRegIdx () && RegIdx.Kind & RegKind_FGR && RegIdx.Index <= 31 ;
@@ -3036,6 +3075,45 @@ MipsAsmParser::parseRegisterPair(OperandVector &Operands) {
3036
3075
return MatchOperand_Success;
3037
3076
}
3038
3077
3078
+ MipsAsmParser::OperandMatchResultTy
3079
+ MipsAsmParser::parseMovePRegPair (OperandVector &Operands) {
3080
+ MCAsmParser &Parser = getParser ();
3081
+ SmallVector<std::unique_ptr<MCParsedAsmOperand>, 8 > TmpOperands;
3082
+ SmallVector<unsigned , 10 > Regs;
3083
+
3084
+ if (Parser.getTok ().isNot (AsmToken::Dollar))
3085
+ return MatchOperand_ParseFail;
3086
+
3087
+ SMLoc S = Parser.getTok ().getLoc ();
3088
+
3089
+ if (parseAnyRegister (TmpOperands) != MatchOperand_Success)
3090
+ return MatchOperand_ParseFail;
3091
+
3092
+ MipsOperand *Reg = &static_cast <MipsOperand &>(*TmpOperands.back ());
3093
+ unsigned RegNo = isGP64bit () ? Reg->getGPR64Reg () : Reg->getGPR32Reg ();
3094
+ Regs.push_back (RegNo);
3095
+
3096
+ SMLoc E = Parser.getTok ().getLoc ();
3097
+ if (Parser.getTok ().isNot (AsmToken::Comma)) {
3098
+ Error (E, " ',' expected" );
3099
+ return MatchOperand_ParseFail;
3100
+ }
3101
+
3102
+ // Remove comma.
3103
+ Parser.Lex ();
3104
+
3105
+ if (parseAnyRegister (TmpOperands) != MatchOperand_Success)
3106
+ return MatchOperand_ParseFail;
3107
+
3108
+ Reg = &static_cast <MipsOperand &>(*TmpOperands.back ());
3109
+ RegNo = isGP64bit () ? Reg->getGPR64Reg () : Reg->getGPR32Reg ();
3110
+ Regs.push_back (RegNo);
3111
+
3112
+ Operands.push_back (MipsOperand::CreateRegList (Regs, S, E, *this ));
3113
+
3114
+ return MatchOperand_Success;
3115
+ }
3116
+
3039
3117
MCSymbolRefExpr::VariantKind MipsAsmParser::getVariantKind (StringRef Symbol) {
3040
3118
3041
3119
MCSymbolRefExpr::VariantKind VK =
0 commit comments