1*67e74705SXin Li // REQUIRES: x86-registered-target 2*67e74705SXin Li // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks 3*67e74705SXin Li // Disabling gnu inline assembly should have no effect on this testcase 4*67e74705SXin Li // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm 5*67e74705SXin Li 6*67e74705SXin Li #define M __asm int 0x2c 7*67e74705SXin Li #define M2 int 8*67e74705SXin Li t1(void)9*67e74705SXin Livoid t1(void) { M } t2(void)10*67e74705SXin Livoid t2(void) { __asm int 0x2c } t3(void)11*67e74705SXin Livoid t3(void) { __asm M2 0x2c } t4(void)12*67e74705SXin Livoid t4(void) { __asm mov eax, fs:[0x10] } t5()13*67e74705SXin Livoid t5() { 14*67e74705SXin Li __asm { 15*67e74705SXin Li int 0x2c ; } asm comments are fun! }{ 16*67e74705SXin Li } 17*67e74705SXin Li __asm {} 18*67e74705SXin Li } 19*67e74705SXin Li int t6() { 20*67e74705SXin Li __asm int 3 ; } comments for single-line asm 21*67e74705SXin Li __asm {} 22*67e74705SXin Li 23*67e74705SXin Li __asm int 4 24*67e74705SXin Li return 10; 25*67e74705SXin Li } 26*67e74705SXin Li void t7() { 27*67e74705SXin Li __asm { 28*67e74705SXin Li push ebx 29*67e74705SXin Li mov ebx, 0x07 30*67e74705SXin Li pop ebx 31*67e74705SXin Li } 32*67e74705SXin Li } 33*67e74705SXin Li void t8() { 34*67e74705SXin Li __asm nop __asm nop __asm nop 35*67e74705SXin Li } 36*67e74705SXin Li void t9() { 37*67e74705SXin Li __asm nop __asm nop ; __asm nop 38*67e74705SXin Li } 39*67e74705SXin Li void t10() { 40*67e74705SXin Li __asm { 41*67e74705SXin Li mov eax, 0 42*67e74705SXin Li __asm { 43*67e74705SXin Li mov eax, 1 44*67e74705SXin Li { 45*67e74705SXin Li mov eax, 2 46*67e74705SXin Li } 47*67e74705SXin Li } 48*67e74705SXin Li } 49*67e74705SXin Li } 50*67e74705SXin Li void t11() { 51*67e74705SXin Li do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0); 52*67e74705SXin Li } 53*67e74705SXin Li void t12() { 54*67e74705SXin Li __asm jmp label // expected-error {{use of undeclared label 'label'}} 55*67e74705SXin Li } 56*67e74705SXin Li void t13() { 57*67e74705SXin Li __asm m{o}v eax, ebx // expected-error {{expected identifier}} expected-error {{use of undeclared label '{o}v eax, ebx'}} 58*67e74705SXin Li } 59*67e74705SXin Li 60*67e74705SXin Li int t_fail() { // expected-note {{to match this}} 61*67e74705SXin Li __asm 62*67e74705SXin Li __asm { // expected-error 3 {{expected}} expected-note {{to match this}} 63