From: Anders Carlsson Date: Fri, 3 Apr 2009 05:57:08 +0000 (+0000) Subject: Ignore plus operands when looking up the operand number from a named operand. This... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec91dab1977154f13621cfb63184364afee84ea1;p=clang Ignore plus operands when looking up the operand number from a named operand. This matches llvm-gcc and fixes PR3908. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68371 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 0cf36f98a8..ce55fae87e 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -177,9 +177,6 @@ int AsmStmt::getNamedOperand(const std::string &SymbolicName) const { for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) { if (getOutputName(i) == SymbolicName) return i; - - // Keep track of the number of '+' operands. - if (isOutputPlusConstraint(i)) ++NumPlusOperands; } for (unsigned i = 0, e = getNumInputs(); i != e; ++i) diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index 91d6320ac5..abe91519ed 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -28,7 +28,7 @@ void t6(void) { __asm__ volatile("" : : "i" (t6)); } -// RUN: grep "T7 NAMED: \$2" %t && +// RUN: grep "T7 NAMED: \$1" %t && void t7(int a) { __asm__ volatile("T7 NAMED: %[input]" : "+r"(a): [input] "i" (4)); } @@ -43,3 +43,9 @@ unsigned t9(unsigned int a) { asm("bswap %0 %1" : "+r" (a)); return a; } + +// PR3908 +// RUN: grep "PR3908 \$1 \$3 \$2 \$0" %t +void t10(int r) { + __asm__("PR3908 %[lf] %[xx] %[li] %[r]" : [r] "+r" (r) : [lf] "mx" (0), [li] "mr" (0), [xx] "x" ((double)(0))); +}