diff options
author | Anders Carlsson <andersca@mac.com> | 2009-01-11 21:23:27 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-01-11 21:23:27 +0000 |
commit | 9f2505b934745b18d580ade4dac7b8b16952a30c (patch) | |
tree | e8e37baedefb465f4e67abc5b564aafdeafff3b4 | |
parent | d7a7c00e077111a78a3fe644da59624806ef9e65 (diff) |
More inline asm fixes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62049 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 5 | ||||
-rw-r--r-- | test/CodeGen/asm.c | 22 |
2 files changed, 23 insertions, 4 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index bee40e5c28..fd01905698 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -944,7 +944,10 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { const Expr *InputExpr = S.getOutputExpr(i); llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, InOutConstraints); - InOutConstraints += llvm::utostr(Args.size()); + if (Info & TargetInfo::CI_AllowsRegister) + InOutConstraints += llvm::utostr(i); + else + InOutConstraints += OutputConstraint; InOutArgTypes.push_back(Arg->getType()); InOutArgs.push_back(Arg); diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index d6fbf77408..0b6485ebff 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -1,5 +1,21 @@ -// RUN: clang %s -arch=i386 -verify -fsyntax-only -void f(int len) +// RUN: clang -emit-llvm %s -o %t -arch=i386 +void t1(int len) { - __asm__ volatile("" :"=&r"(len), "+&r"(len)); + __asm__ volatile("" : "=&r"(len), "+&r"(len)); } + +void t2(unsigned long long t) +{ + __asm__ volatile("" : "+m"(t)); +} + +void t3(unsigned char *src, unsigned long long temp) +{ + __asm__ volatile("" : "+m"(temp), "+r"(src)); +} + + + + + + |