diff options
Diffstat (limited to 'test/Sema/asm.c')
-rw-r--r-- | test/Sema/asm.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/test/Sema/asm.c b/test/Sema/asm.c index 1a1e029..d29b136 100644 --- a/test/Sema/asm.c +++ b/test/Sema/asm.c @@ -1,7 +1,6 @@ // RUN: %clang_cc1 %s -Wno-private-extern -triple i386-pc-linux-gnu -verify -fsyntax-only - void f() { int i; @@ -154,10 +153,13 @@ double test15() { // PR19837 struct foo { int a; - char b; }; -register struct foo bar asm("sp"); // expected-error {{bad type for named register variable}} -register float baz asm("sp"); // expected-error {{bad type for named register variable}} +register struct foo bar asm("esp"); // expected-error {{bad type for named register variable}} +register float baz asm("esp"); // expected-error {{bad type for named register variable}} + +register int r0 asm ("edi"); // expected-error {{register 'edi' unsuitable for global register variables on this target}} +register long long r1 asm ("esp"); // expected-error {{size of register 'esp' does not match variable size}} +register int r2 asm ("esp"); double f_output_constraint(void) { double result; @@ -211,13 +213,40 @@ typedef struct test16_foo { unsigned int field2 : 2; unsigned int field3 : 3; } test16_foo; -test16_foo x; +typedef __attribute__((vector_size(16))) int test16_bar; +register int test16_baz asm("esp"); + void test16() { + test16_foo a; + test16_bar b; + + __asm__("movl $5, %0" + : "=rm" (a.field2)); // expected-error {{reference to a bit-field in asm input with a memory constraint '=rm'}} + __asm__("movl $5, %0" + : + : "m" (a.field3)); // expected-error {{reference to a bit-field in asm output with a memory constraint 'm'}} __asm__("movl $5, %0" - : "=rm" (x.field2)); // expected-error {{reference to a bit-field in asm output with a memory constraint '=rm'}} + : "=rm" (b[2])); // expected-error {{reference to a vector element in asm input with a memory constraint '=rm'}} __asm__("movl $5, %0" : - : "m" (x.field3)); // expected-error {{reference to a bit-field in asm input with a memory constraint 'm'}} + : "m" (b[3])); // expected-error {{reference to a vector element in asm output with a memory constraint 'm'}} + __asm__("movl $5, %0" + : "=rm" (test16_baz)); // expected-error {{reference to a global register variable in asm input with a memory constraint '=rm'}} + __asm__("movl $5, %0" + : + : "m" (test16_baz)); // expected-error {{reference to a global register variable in asm output with a memory constraint 'm'}} +} + +int test17(int t0) +{ + int r0, r1; + __asm ("addl %2, %2\n\t" + "movl $123, %0" + : "=a" (r0), + "=&r" (r1) + : "1" (t0), // expected-note {{constraint '1' is already present here}} + "1" (t0)); // expected-error {{more than one input constraint matches the same output '1'}} + return r0 + r1; } |