efriedma added a comment.

For the "=x" thing I was talking about, try the following testcase:

  void a() { struct S { unsigned x[4]; } z; asm volatile("%0":"=x"(z)); }
  void a2() { struct S { unsigned x[8]; } z; asm volatile("%0":"=x"(z)); }

clang trunk gives "error: couldn't allocate output register for constraint 'x'" 
in the backend for both functions.  gcc prints "%xmm0" for the first, and 
rejects the second; not exactly sure why it's rejecting the second, though.  It 
would be nice if both worked, although I guess it's okay if we print a 
reasonable error message.  Please add a testcase, at least.



================
Comment at: clang/test/CodeGen/x86_64-PR42672.c:3
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -USTRUCT -emit-llvm %s -o 
- | FileCheck %s --check-prefix=CHECK-NOSTRUCT
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -DIMPOSSIBLE_ODD 
-emit-llvm %s -o - 2> %t || true
+// RUN: grep "impossible constraint in asm" %t
----------------
You can prefix a command in a RUN line with "not" if you expect it to return a 
non-zero error code.  So you can write `not %clang_cc1 [...] 2>&1 | FileCheck 
%s` or something like that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65234/new/

https://reviews.llvm.org/D65234



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to