[PATCH] D65234: [CodeGen]: don't treat structures returned in registers as memory inputs

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 13:50:48 PDT 2019


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





More information about the cfe-commits mailing list