2013-12-09 05:12:27 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2013-01-23 05:39:58 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
|
2015-01-17 07:05:28 +08:00
|
|
|
// Disabling gnu inline assembly should have no effect on this testcase
|
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm
|
2011-09-30 09:13:51 +08:00
|
|
|
|
|
|
|
#define M __asm int 0x2c
|
|
|
|
#define M2 int
|
|
|
|
|
2013-01-23 02:18:22 +08:00
|
|
|
void t1(void) { M }
|
|
|
|
void t2(void) { __asm int 0x2c }
|
|
|
|
void t3(void) { __asm M2 0x2c }
|
|
|
|
void t4(void) { __asm mov eax, fs:[0x10] }
|
2011-09-30 09:13:51 +08:00
|
|
|
void t5() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {
|
2011-09-30 09:13:51 +08:00
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {}
|
2011-09-30 09:13:51 +08:00
|
|
|
}
|
|
|
|
int t6() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm int 3 ; } comments for single-line asm
|
|
|
|
__asm {}
|
2011-09-30 09:13:51 +08:00
|
|
|
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm int 4
|
2011-09-30 09:13:51 +08:00
|
|
|
return 10;
|
|
|
|
}
|
2012-08-25 05:42:51 +08:00
|
|
|
void t7() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {
|
2012-06-13 03:03:42 +08:00
|
|
|
push ebx
|
|
|
|
mov ebx, 0x07
|
|
|
|
pop ebx
|
|
|
|
}
|
|
|
|
}
|
2012-06-13 04:30:26 +08:00
|
|
|
void t8() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm nop __asm nop __asm nop
|
2012-06-13 04:30:26 +08:00
|
|
|
}
|
|
|
|
void t9() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm nop __asm nop ; __asm nop
|
2012-06-13 04:30:26 +08:00
|
|
|
}
|
2014-07-06 13:26:54 +08:00
|
|
|
void t10() {
|
|
|
|
__asm {
|
|
|
|
mov eax, 0
|
|
|
|
__asm {
|
|
|
|
mov eax, 1
|
|
|
|
{
|
|
|
|
mov eax, 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-15 10:21:41 +08:00
|
|
|
void t11() {
|
|
|
|
do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
|
|
|
|
}
|
2014-09-22 10:21:54 +08:00
|
|
|
void t12() {
|
|
|
|
__asm jmp label // expected-error {{use of undeclared label 'label'}}
|
|
|
|
}
|
2012-06-13 03:03:42 +08:00
|
|
|
int t_fail() { // expected-note {{to match this}}
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { // expected-error 2 {{expected}} expected-note {{to match this}}
|