patch to handle commas in clobberlists like gcc does. i.e. "=A,A"
the form "=AA" already appears to work, but the commas were causing
trouble in semantic validation ("," unrecognized) and in parsing
canonicalized asm (which already uses "," to separate constraints)
error found in FreeBSD driver, but examples found elsewhere for 32-bit
targets handling 64-bit math, i.e.
http://gcc.gnu.org/ml/gcc-bugs/2000-02/msg00104.html (search for
"=A,A")
passes all clang tests; i wanted a review because my asm-fu is weak.
let me know if this is horrible. thanks!
Ryan
Index: test/Sema/asm.c
===================================================================
--- test/Sema/asm.c (revision 78805)
+++ test/Sema/asm.c (working copy)
@@ -76,3 +76,10 @@
asm volatile("foo %0 %1" : "=a" (a) :"0" (b)); // expected-error {{input with type 'unsigned long long' matching output with type 'int'}}
return a;
}
+
+// allow comma-separated clobberlist operands like gcc does
+unsigned long long commas(unsigned long b, unsigned long c) {
+ unsigned long long a;
+ __asm__("mull %2" : "=A,A"(a) : "%a,%a"(b), "r,m"(c) : "cc");
+ return a;
+}
Index: lib/Basic/TargetInfo.cpp
===================================================================
--- lib/Basic/TargetInfo.cpp (revision 78805)
+++ lib/Basic/TargetInfo.cpp (working copy)
@@ -187,6 +187,7 @@
return false;
}
case '&': // early clobber.
+ case ',': // comma-separated operands
break;
case 'r': // general register.
Info.setAllowsRegister();
@@ -264,6 +265,8 @@
break;
}
+ case ',': // comma-separated operands
+ break;
case '%': // commutative
// FIXME: Fail if % is used with the last operand.
break;
Index: lib/CodeGen/CGStmt.cpp
===================================================================
--- lib/CodeGen/CGStmt.cpp (revision 78805)
+++ lib/CodeGen/CGStmt.cpp (working copy)
@@ -741,6 +741,7 @@
case '*':
case '?':
case '!':
+ case ',':
break;
case 'g':
Result += "imr";
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits