summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-15 04:04:33 +0000
committerChris Lattner <sabre@nondot.org>2010-09-15 04:04:33 +0000
commit4dbcba0082d89d6eb7670f7b28cffbd8d522560a (patch)
treebd452124870b7e25fc0999d189cd568893db3778 /llvm/lib
parent46d4cc2ef7396e5dcb45009a1825801e7b67abe6 (diff)
downloadbcm5719-llvm-4dbcba0082d89d6eb7670f7b28cffbd8d522560a.tar.gz
bcm5719-llvm-4dbcba0082d89d6eb7670f7b28cffbd8d522560a.zip
add a bunch of aliases for fp operations with no operand,
rdar://8431422 llvm-svn: 113929
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 50529313403..dde34631ef4 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -923,6 +923,24 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
std::swap(Operands[1], Operands[2]);
}
+ // The assembler accepts these instructions with no operand as a synonym for
+ // an instruction acting on st(1). e.g. "fxch" -> "fxch %st(1)".
+ if ((Name == "fxch" || Name == "fucom" || Name == "fucomp" ||
+ Name == "faddp" || Name == "fsubp" || Name == "fsubrp" ||
+ Name == "fmulp" || Name == "fdivp" || Name == "fdivrp") &&
+ Operands.size() == 1) {
+ Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
+ NameLoc, NameLoc));
+ }
+
+ // The assembler accepts these instructions with no operand as a synonym for
+ // an instruction acting on st,st(1). e.g. "faddp" -> "faddp %st(0),%st(1)".
+ //if (() &&
+ // Operands.size() == 1) {
+ // Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
+ // NameLoc, NameLoc));
+ //}
+
return false;
}
@@ -959,11 +977,10 @@ bool X86ATTAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
}
-bool
-X86ATTAsmParser::MatchInstruction(SMLoc IDLoc,
- const SmallVectorImpl<MCParsedAsmOperand*>
- &Operands,
- MCInst &Inst) {
+bool X86ATTAsmParser::
+MatchInstruction(SMLoc IDLoc,
+ const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
+ MCInst &Inst) {
assert(!Operands.empty() && "Unexpect empty operand list!");
bool WasOriginallyInvalidOperand = false;
OpenPOWER on IntegriCloud