]> granicus.if.org Git - clang/commitdiff
More inline asm fixes
authorAnders Carlsson <andersca@mac.com>
Sun, 11 Jan 2009 21:23:27 +0000 (21:23 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 11 Jan 2009 21:23:27 +0000 (21:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62049 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/asm.c

index bee40e5c28beed19aa796f38eed3d43bc05e0408..fd01905698a930c26ea88ef935bd4a921fb0d2b9 100644 (file)
@@ -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);
index d6fbf7740810ff8a27f4d54b9c7b14de1856cd2a..0b6485ebfff9a1a2ecc8012865277ff19981ba06 100644 (file)
@@ -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));
+}
+
+
+
+
+
+