1 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
4 #if !__has_extension(gnu_asm)
5 #error Extension 'gnu_asm' should be available by default
7 #if !__has_extension(gnu_asm_goto_with_outputs)
8 #error Extension 'gnu_asm_goto_with_outputs' should be available by default
10 #if !__has_extension(gnu_asm_goto_with_outputs_full)
11 #error Extension 'gnu_asm_goto_with_outputs_full' should be available by default
14 int a
, b
, c
, d
, e
, f
, g
, h
, i
, j
, k
, l
;
17 __asm__
volatile goto (""
18 :: [a
] "r" (a
), [b
] "r" (b
), [c
] "r" (c
), [d
] "r" (d
),
19 [e
] "r" (e
), [f
] "r" (f
), [g
] "r" (g
), [h
] "r" (h
),
20 [i
] "r" (i
), [j
] "r" (j
), [k
] "r" (k
), [l
] "r" (l
)
27 __asm__
volatile goto (""
28 :: [a
] "r,m" (a
), [b
] "r,m" (b
), [c
] "r,m" (c
), [d
] "r,m" (d
),
29 [e
] "r,m" (e
), [f
] "r,m" (f
), [g
] "r,m" (g
), [h
] "r,m" (h
),
30 [i
] "r,m" (i
), [j
] "r,m" (j
), [k
] "r,m" (k
), [l
] "r,m" (l
)
36 __asm__
volatile goto ("decl %0; jnz %l[a]"
37 : "=r" (x
) : "m" (x
) : "memory" : a
);
45 __asm__
volatile goto ("decl %0; jnz %l[a]"
46 : "=r" (x
), "=r" (y
) : "m" (x
) : "memory" : a
);
48 __asm__
volatile goto ("decl %0; jnz %l[b]"
49 : "=r" (x
), "=r" (y
) : "m" (x
) : "memory" : b
);
59 // expected-error@+1 {{expected ')'}}
60 asm ("mov %[e], %[e]" : : [e
] "rm" (*e
)::a
)
61 // expected-error@+1 {{expected identifier}}
62 asm goto ("decl %0;" :: "m"(x
) : "memory" : );
63 // expected-error@+1 {{expected ':'}}
64 asm goto ("decl %0;" :: "m"(x
) : "memory" );
65 // expected-error@+1 {{use of undeclared label 'x'}}
66 asm goto ("decl %0;" :: "m"(x
) : "memory" :x
);
67 // expected-error@+1 {{use of undeclared label 'b'}}
68 asm goto ("decl %0;" :: "m"(x
) : "memory" :b
);
69 // expected-error@+1 {{invalid operand number in inline asm string}}
70 asm goto ("testl %0, %0; jne %l3;" :: "r"(cond
)::label_true
, loop
);
71 // expected-error@+1 {{unknown symbolic operand name in inline assembly string}}
72 asm goto ("decl %0; jnz %l[b]" :: "m"(x
) : "memory" : a
);
81 // expected-error@+1 {{expected ')'}}
82 asm ("mov %[e], %[e]" : "=r" (y
) : [e
] "rm" (*e
), "r" (y
) :: a
)
83 // expected-error@+1 {{expected identifier}}
84 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" :);
85 // expected-error@+1 {{expected ':'}}
86 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory");
87 // expected-error@+1 {{use of undeclared label 'x'}}
88 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : x
);
89 // expected-error@+1 {{use of undeclared label 'b'}}
90 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : b
);
91 // expected-error@+1 {{invalid operand number in inline asm string}}
92 asm goto ("testl %0, %0; jne %l5;" : "=r" (y
) : "r" (cond
), "r" (y
) :: label_true
, loop
);
93 // expected-error@+1 {{unknown symbolic operand name in inline assembly string}}
94 asm goto ("decl %0; jnz %l[b]" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : a
);