From: Anders Carlsson Date: Sun, 11 Jan 2009 21:23:27 +0000 (+0000) Subject: More inline asm fixes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f2505b934745b18d580ade4dac7b8b16952a30c;p=clang More inline asm fixes git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62049 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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)); +} + + + + + +