annotate clang/test/Parser/ms-inline-asm.c @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900 (2021-07-18)
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // REQUIRES: x86-registered-target
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
anatofuz
parents:
diff changeset
3 // Disabling gnu inline assembly should have no effect on this testcase
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 #define M __asm int 0x2c
anatofuz
parents:
diff changeset
7 #define M2 int
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 void t1(void) { M }
anatofuz
parents:
diff changeset
10 void t2(void) { __asm int 2ch }
anatofuz
parents:
diff changeset
11 void t3(void) { __asm M2 2ch }
anatofuz
parents:
diff changeset
12 void t4(void) { __asm mov eax, fs:[10h] }
anatofuz
parents:
diff changeset
13 void t5() {
anatofuz
parents:
diff changeset
14 __asm {
anatofuz
parents:
diff changeset
15 int 0x2c ; } asm comments are fun! }{
anatofuz
parents:
diff changeset
16 }
anatofuz
parents:
diff changeset
17 __asm {}
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19 int t6() {
anatofuz
parents:
diff changeset
20 __asm int 3 ; } comments for single-line asm
anatofuz
parents:
diff changeset
21 __asm {}
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 __asm int 4
anatofuz
parents:
diff changeset
24 return 10;
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 void t7() {
anatofuz
parents:
diff changeset
27 __asm {
anatofuz
parents:
diff changeset
28 push ebx
anatofuz
parents:
diff changeset
29 mov ebx, 07h
anatofuz
parents:
diff changeset
30 pop ebx
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32 }
anatofuz
parents:
diff changeset
33 void t8() {
anatofuz
parents:
diff changeset
34 __asm nop __asm nop __asm nop
anatofuz
parents:
diff changeset
35 }
anatofuz
parents:
diff changeset
36 void t9() {
anatofuz
parents:
diff changeset
37 __asm nop __asm nop ; __asm nop
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 void t10() {
anatofuz
parents:
diff changeset
40 __asm {
anatofuz
parents:
diff changeset
41 mov eax, 0
anatofuz
parents:
diff changeset
42 __asm {
anatofuz
parents:
diff changeset
43 mov eax, 1
anatofuz
parents:
diff changeset
44 {
anatofuz
parents:
diff changeset
45 mov eax, 2
anatofuz
parents:
diff changeset
46 }
anatofuz
parents:
diff changeset
47 }
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49 }
anatofuz
parents:
diff changeset
50 void t11() {
anatofuz
parents:
diff changeset
51 do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
anatofuz
parents:
diff changeset
52 }
anatofuz
parents:
diff changeset
53 void t12() {
anatofuz
parents:
diff changeset
54 __asm jmp label // expected-error {{use of undeclared label 'label'}}
anatofuz
parents:
diff changeset
55 }
anatofuz
parents:
diff changeset
56 void t13() {
anatofuz
parents:
diff changeset
57 __asm m{o}v eax, ebx // expected-error {{unknown token in expression}}
anatofuz
parents:
diff changeset
58 }
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 void t14() {
anatofuz
parents:
diff changeset
61 enum { A = 1, B };
anatofuz
parents:
diff changeset
62 __asm mov eax, offset A // expected-error {{offset operator cannot yet handle constants}}
anatofuz
parents:
diff changeset
63 }
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 int t_fail() { // expected-note {{to match this}}
anatofuz
parents:
diff changeset
66 __asm
anatofuz
parents:
diff changeset
67 __asm { // expected-error 3 {{expected}} expected-note {{to match this}}