[cfe-commits] r110764 - in /cfe/trunk: lib/Basic/TargetInfo.cpp test/Parser/asm-constraints-pr7869.c
John Thompson
John.Thompson.JTSoftware at gmail.com
Tue Aug 10 17:58:20 PDT 2010
Author: jtsoftware
Date: Tue Aug 10 19:58:20 2010
New Revision: 110764
URL: http://llvm.org/viewvc/llvm-project?rev=110764&view=rev
Log:
Fix for pr7869, inline asm mult-alt constraints.
Added:
cfe/trunk/test/Parser/asm-constraints-pr7869.c
Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=110764&r1=110763&r2=110764&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Aug 10 19:58:20 2010
@@ -289,11 +289,9 @@
break;
case ',': // multiple alternative constraint. Pass it.
Name++;
- // An output constraint must start with '=' or '+'
- if (*Name != '=' && *Name != '+')
- return false;
- if (*Name == '+')
- Info.setIsReadWrite();
+ // Handle additional optional '=' or '+' modifiers.
+ if (*Name == '=' || *Name == '+')
+ Name++;
break;
case '?': // Disparage slightly code.
case '!': // Disparage severly.
Added: cfe/trunk/test/Parser/asm-constraints-pr7869.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/asm-constraints-pr7869.c?rev=110764&view=auto
==============================================================================
--- cfe/trunk/test/Parser/asm-constraints-pr7869.c (added)
+++ cfe/trunk/test/Parser/asm-constraints-pr7869.c Tue Aug 10 19:58:20 2010
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int a, b, c, d, e, f, g, h, i, j, k, l;
+
+void
+f1 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r" (a), [b] "+r" (b), [c] "+r" (c), [d] "+r" (d),
+ [e] "+r" (e), [f] "+r" (f), [g] "+r" (g), [h] "+r" (h),
+ [i] "+r" (i), [j] "+r" (j), [k] "+r" (k), [l] "+r" (l));
+}
+
+void
+f2 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r,m" (a), [b] "+r,m" (b), [c] "+r,m" (c), [d] "+r,m" (d),
+ [e] "+r,m" (e), [f] "+r,m" (f), [g] "+r,m" (g), [h] "+r,m" (h),
+ [i] "+r,m" (i), [j] "+r,m" (j), [k] "+r,m" (k), [l] "+r,m" (l));
+}
+
+void
+f3 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r" (a), [b] "=r" (b), [c] "=r" (c), [d] "=r" (d),
+ [e] "=r" (e), [f] "=r" (f), [g] "=r" (g), [h] "=r" (h),
+ [i] "=r" (i), [j] "=r" (j), [k] "=r" (k), [l] "=r" (l)
+ : "[a]" (a), "[b]" (b), "[c]" (c), "[d]" (d),
+ "[e]" (e), "[f]" (f), "[g]" (g), "[h]" (h),
+ "[i]" (i), "[j]" (j), "[k]" (k), "[l]" (l));
+}
+
+void
+f4 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r,m" (a), [b] "=r,m" (b), [c] "=r,m" (c), [d] "=r,m" (d),
+ [e] "=r,m" (e), [f] "=r,m" (f), [g] "=r,m" (g), [h] "=r,m" (h),
+ [i] "=r,m" (i), [j] "=r,m" (j), [k] "=r,m" (k), [l] "=r,m" (l)
+ : "[a],m" (a), "[b],m" (b), "[c],m" (c), "[d],m" (d),
+ "[e],m" (e), "[f],m" (f), "[g],m" (g), "[h],m" (h),
+ "[i],m" (i), "[j],m" (j), "[k],m" (k), "[l],m" (l));
+}
More information about the cfe-commits
mailing list