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
11 int a
, b
, c
, d
, e
, f
, g
, h
, i
, j
, k
, l
;
14 __asm__
volatile goto (""
15 :: [a
] "r" (a
), [b
] "r" (b
), [c
] "r" (c
), [d
] "r" (d
),
16 [e
] "r" (e
), [f
] "r" (f
), [g
] "r" (g
), [h
] "r" (h
),
17 [i
] "r" (i
), [j
] "r" (j
), [k
] "r" (k
), [l
] "r" (l
)
24 __asm__
volatile goto (""
25 :: [a
] "r,m" (a
), [b
] "r,m" (b
), [c
] "r,m" (c
), [d
] "r,m" (d
),
26 [e
] "r,m" (e
), [f
] "r,m" (f
), [g
] "r,m" (g
), [h
] "r,m" (h
),
27 [i
] "r,m" (i
), [j
] "r,m" (j
), [k
] "r,m" (k
), [l
] "r,m" (l
)
33 __asm__
volatile goto ("decl %0; jnz %l[a]"
34 : "=r" (x
) : "m" (x
) : "memory" : a
);
42 __asm__
volatile goto ("decl %0; jnz %l[a]"
43 : "=r" (x
), "=r" (y
) : "m" (x
) : "memory" : a
);
45 __asm__
volatile goto ("decl %0; jnz %l[b]"
46 : "=r" (x
), "=r" (y
) : "m" (x
) : "memory" : b
);
56 // expected-error@+1 {{expected ')'}}
57 asm ("mov %[e], %[e]" : : [e
] "rm" (*e
)::a
)
58 // expected-error@+1 {{expected identifier}}
59 asm goto ("decl %0;" :: "m"(x
) : "memory" : );
60 // expected-error@+1 {{expected ':'}}
61 asm goto ("decl %0;" :: "m"(x
) : "memory" );
62 // expected-error@+1 {{use of undeclared label 'x'}}
63 asm goto ("decl %0;" :: "m"(x
) : "memory" :x
);
64 // expected-error@+1 {{use of undeclared label 'b'}}
65 asm goto ("decl %0;" :: "m"(x
) : "memory" :b
);
66 // expected-error@+1 {{invalid operand number in inline asm string}}
67 asm goto ("testl %0, %0; jne %l3;" :: "r"(cond
)::label_true
, loop
);
68 // expected-error@+1 {{unknown symbolic operand name in inline assembly string}}
69 asm goto ("decl %0; jnz %l[b]" :: "m"(x
) : "memory" : a
);
78 // expected-error@+1 {{expected ')'}}
79 asm ("mov %[e], %[e]" : "=r" (y
) : [e
] "rm" (*e
), "r" (y
) :: a
)
80 // expected-error@+1 {{expected identifier}}
81 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" :);
82 // expected-error@+1 {{expected ':'}}
83 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory");
84 // expected-error@+1 {{use of undeclared label 'x'}}
85 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : x
);
86 // expected-error@+1 {{use of undeclared label 'b'}}
87 asm goto ("decl %0;" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : b
);
88 // expected-error@+1 {{invalid operand number in inline asm string}}
89 asm goto ("testl %0, %0; jne %l5;" : "=r" (y
) : "r" (cond
), "r" (y
) :: label_true
, loop
);
90 // expected-error@+1 {{unknown symbolic operand name in inline assembly string}}
91 asm goto ("decl %0; jnz %l[b]" : "=r" (y
) : "m" (x
), "r" (y
) : "memory" : a
);