summaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-05-15 11:16:19 +0000
committerTim Northover <tnorthover@apple.com>2014-05-15 11:16:19 +0000
commitd74434656619d19e3e5c3dec79c6ccdaef567bec (patch)
tree489e12196412c21f45ea35c30c571a33d157c1e1 /lib/Target
parent75aa5372bcf4e58c9ae4ef0b9aae86993b39c338 (diff)
downloadllvm-d74434656619d19e3e5c3dec79c6ccdaef567bec.tar.gz
llvm-d74434656619d19e3e5c3dec79c6ccdaef567bec.tar.bz2
llvm-d74434656619d19e3e5c3dec79c6ccdaef567bec.tar.xz
ARM64: add correct vector registers during asm parsing
Previously, we ignored the difference between V64 and V128 when parsing assembly: they both got mapped to registers in the FPR128 class. This is basically harmless at the moment because they both print and encode the same way. However, it will affect the printing of aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM64/ARM64RegisterInfo.td19
-rw-r--r--lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp9
2 files changed, 23 insertions, 5 deletions
diff --git a/lib/Target/ARM64/ARM64RegisterInfo.td b/lib/Target/ARM64/ARM64RegisterInfo.td
index c6ce671d56..fb82598ff7 100644
--- a/lib/Target/ARM64/ARM64RegisterInfo.td
+++ b/lib/Target/ARM64/ARM64RegisterInfo.td
@@ -434,10 +434,21 @@ def QQQQ : RegisterClass<"ARM64", [untyped], 128, (add QSeqQuads)> {
// Vector operand versions of the FP registers. Alternate name printing and
// assmebler matching.
-def VectorRegAsmOperand : AsmOperandClass { let Name = "VectorReg"; }
-let ParserMatchClass = VectorRegAsmOperand in {
-def V64 : RegisterOperand<FPR64, "printVRegOperand">;
-def V128 : RegisterOperand<FPR128, "printVRegOperand">;
+def VectorReg64AsmOperand : AsmOperandClass {
+ let Name = "VectorReg64";
+ let PredicateMethod = "isVectorReg";
+}
+def VectorReg128AsmOperand : AsmOperandClass {
+ let Name = "VectorReg128";
+ let PredicateMethod = "isVectorReg";
+}
+
+def V64 : RegisterOperand<FPR64, "printVRegOperand"> {
+ let ParserMatchClass = VectorReg64AsmOperand;
+}
+
+def V128 : RegisterOperand<FPR128, "printVRegOperand"> {
+ let ParserMatchClass = VectorReg128AsmOperand;
}
def VectorRegLoAsmOperand : AsmOperandClass { let Name = "VectorRegLo"; }
diff --git a/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp b/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
index a68f4db633..d95a51167d 100644
--- a/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
+++ b/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
@@ -1188,8 +1188,15 @@ public:
Inst.addOperand(MCOperand::CreateReg(getReg()));
}
- void addVectorRegOperands(MCInst &Inst, unsigned N) const {
+ void addVectorReg64Operands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
+ assert(ARM64MCRegisterClasses[ARM64::FPR128RegClassID].contains(getReg()));
+ Inst.addOperand(MCOperand::CreateReg(ARM64::D0 + getReg() - ARM64::Q0));
+ }
+
+ void addVectorReg128Operands(MCInst &Inst, unsigned N) const {
+ assert(N == 1 && "Invalid number of operands!");
+ assert(ARM64MCRegisterClasses[ARM64::FPR128RegClassID].contains(getReg()));
Inst.addOperand(MCOperand::CreateReg(getReg()));
}