xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/ms-inline-asm.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // REQUIRES: x86-registered-target
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc #define M __asm int 0x2c
5f4a2713aSLionel Sambuc #define M2 int
6f4a2713aSLionel Sambuc 
t1(void)7f4a2713aSLionel Sambuc void t1(void) { M }
t2(void)8f4a2713aSLionel Sambuc void t2(void) { __asm int 0x2c }
t3(void)9f4a2713aSLionel Sambuc void t3(void) { __asm M2 0x2c }
t4(void)10f4a2713aSLionel Sambuc void t4(void) { __asm mov eax, fs:[0x10] }
t5()11f4a2713aSLionel Sambuc void t5() {
12f4a2713aSLionel Sambuc   __asm {
13f4a2713aSLionel Sambuc     int 0x2c ; } asm comments are fun! }{
14f4a2713aSLionel Sambuc   }
15f4a2713aSLionel Sambuc   __asm {}
16f4a2713aSLionel Sambuc }
17f4a2713aSLionel Sambuc int t6() {
18f4a2713aSLionel Sambuc   __asm int 3 ; } comments for single-line asm
19f4a2713aSLionel Sambuc   __asm {}
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc   __asm int 4
22f4a2713aSLionel Sambuc   return 10;
23f4a2713aSLionel Sambuc }
24f4a2713aSLionel Sambuc void t7() {
25f4a2713aSLionel Sambuc   __asm {
26f4a2713aSLionel Sambuc     push ebx
27f4a2713aSLionel Sambuc     mov ebx, 0x07
28f4a2713aSLionel Sambuc     pop ebx
29f4a2713aSLionel Sambuc   }
30f4a2713aSLionel Sambuc }
31f4a2713aSLionel Sambuc void t8() {
32f4a2713aSLionel Sambuc   __asm nop __asm nop __asm nop
33f4a2713aSLionel Sambuc }
34f4a2713aSLionel Sambuc void t9() {
35f4a2713aSLionel Sambuc   __asm nop __asm nop ; __asm nop
36f4a2713aSLionel Sambuc }
37*0a6a1f1dSLionel Sambuc void t10() {
38*0a6a1f1dSLionel Sambuc   __asm {
39*0a6a1f1dSLionel Sambuc     mov eax, 0
40*0a6a1f1dSLionel Sambuc     __asm {
41*0a6a1f1dSLionel Sambuc       mov eax, 1
42*0a6a1f1dSLionel Sambuc       {
43*0a6a1f1dSLionel Sambuc         mov eax, 2
44*0a6a1f1dSLionel Sambuc       }
45*0a6a1f1dSLionel Sambuc     }
46*0a6a1f1dSLionel Sambuc   }
47*0a6a1f1dSLionel Sambuc }
48*0a6a1f1dSLionel Sambuc void t11() {
49*0a6a1f1dSLionel Sambuc   do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
50*0a6a1f1dSLionel Sambuc }
51*0a6a1f1dSLionel Sambuc void t12() {
52*0a6a1f1dSLionel Sambuc   __asm jmp label // expected-error {{use of undeclared label 'label'}}
53*0a6a1f1dSLionel Sambuc }
54f4a2713aSLionel Sambuc int t_fail() { // expected-note {{to match this}}
55f4a2713aSLionel Sambuc   __asm
56*0a6a1f1dSLionel Sambuc   __asm { // expected-error 2 {{expected}} expected-note {{to match this}}
57