aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-31 19:42:44 +0000
committerChris Lattner <sabre@nondot.org>2006-10-31 19:42:44 +0000
commit1a60aa7bc1e48150785402e0ae69276f78080d33 (patch)
treed9e0b446a0ec2b669779b0ae41893256a08b5c7a
parent53069fbbae2558a3138df24776448791fea3acee (diff)
handle "st" as "st(0)"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31320 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 96ab93949d..83bf280733 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -32,6 +32,7 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/ADT/StringExtras.h"
using namespace llvm;
// FIXME: temporary.
@@ -5532,9 +5533,17 @@ X86TargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
// constraint into a member of a register class.
std::pair<unsigned, const TargetRegisterClass*> Res;
Res = TargetLowering::getRegForInlineAsmConstraint(Constraint, VT);
-
- // Not found? Bail out.
- if (Res.second == 0) return Res;
+
+ // Not found as a standard register?
+ if (Res.second == 0) {
+ // GCC calls "st(0)" just plain "st".
+ if (StringsEqualNoCase("{st}", Constraint)) {
+ Res.first = X86::ST0;
+ Res.second = X86::RSTRegisterClass;
+ }
+
+ return Res;
+ }
// Otherwise, check to see if this is a register class of the wrong value
// type. For example, we want to map "{ax},i32" -> {eax}, we don't want it to