blob: c6db6020590e56a7f4988e8af204ab826173f4df [file] [log] [blame]
Chad Rosier15490fd2012-12-05 21:08:21 +00001// RUN: %clang_cc1 %s -verify -fasm-blocks
Eli Friedman3fedbe12011-09-30 01:13:51 +00002
3#define M __asm int 0x2c
4#define M2 int
5
Chad Rosierc666cf42013-01-22 18:18:22 +00006void t1(void) { M }
7void t2(void) { __asm int 0x2c }
8void t3(void) { __asm M2 0x2c }
9void t4(void) { __asm mov eax, fs:[0x10] }
Eli Friedman3fedbe12011-09-30 01:13:51 +000010void t5() {
Chad Rosierc666cf42013-01-22 18:18:22 +000011 __asm {
Eli Friedman3fedbe12011-09-30 01:13:51 +000012 int 0x2c ; } asm comments are fun! }{
13 }
Chad Rosierc666cf42013-01-22 18:18:22 +000014 __asm {}
Eli Friedman3fedbe12011-09-30 01:13:51 +000015}
16int t6() {
Chad Rosierc666cf42013-01-22 18:18:22 +000017 __asm int 3 ; } comments for single-line asm
18 __asm {}
Eli Friedman3fedbe12011-09-30 01:13:51 +000019
Chad Rosierc666cf42013-01-22 18:18:22 +000020 __asm int 4
Eli Friedman3fedbe12011-09-30 01:13:51 +000021 return 10;
22}
Chad Rosier56d7f232012-08-24 21:42:51 +000023void t7() {
Chad Rosierc666cf42013-01-22 18:18:22 +000024 __asm {
Chad Rosiera01eddb2012-06-12 19:03:42 +000025 push ebx
26 mov ebx, 0x07
27 pop ebx
28 }
29}
Chad Rosierb3b26bf2012-06-12 20:30:26 +000030void t8() {
Chad Rosierc666cf42013-01-22 18:18:22 +000031 __asm nop __asm nop __asm nop
Chad Rosierb3b26bf2012-06-12 20:30:26 +000032}
33void t9() {
Chad Rosierc666cf42013-01-22 18:18:22 +000034 __asm nop __asm nop ; __asm nop
Chad Rosierb3b26bf2012-06-12 20:30:26 +000035}
Chad Rosiera01eddb2012-06-12 19:03:42 +000036int t_fail() { // expected-note {{to match this}}
Chad Rosierc666cf42013-01-22 18:18:22 +000037 __asm
38 __asm { // expected-error 3 {{expected}} expected-note {{to match this}}