1// RUN: llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s
2
3.macro abc a b:vararg
4.globl "\a, \b"
5.endm
6
7// CHECK: .globl "zed0, zed1, zed2"
8abc zed0, zed1, zed2
9
10.purgem abc
11
12.macro ifcc arg:vararg
13.if cc
14            \arg
15.endif
16.endm
17
18.macro ifcc2 arg0 arg1:vararg
19.if cc
20            movl \arg0, \arg1
21.endif
22.endm
23
24.macro ifcc3 arg0, arg1:vararg
25.if cc
26            movl \arg0, \arg1
27.endif
28.endm
29
30.macro ifcc4 arg0, arg1:vararg
31.if cc
32            movl \arg1, \arg0
33.endif
34.endm
35
36.text
37
38// CHECK: movl %esp, %ebp
39// CHECK: subl $0, %esp
40// CHECK: movl %eax, %ebx
41// CHECK: movl %ecx, %ebx
42// CHECK: movl %ecx, %eax
43// CHECK: movl %eax, %ecx
44// CHECK: movl %ecx, %eax
45// CHECK: movl %eax, %ecx
46.set cc,1
47  ifcc  movl    %esp, %ebp
48        subl $0, %esp
49
50  ifcc2 %eax, %ebx
51  ifcc2 %ecx, %ebx
52  ifcc3 %ecx, %eax
53  ifcc3 %eax, %ecx
54  ifcc4 %eax, %ecx  ## test
55  ifcc4 %ecx, %eax ## test
56
57// CHECK-NOT: movl
58// CHECK: subl $1, %esp
59.set cc,0
60  ifcc  movl,    %esp, %ebp
61        subl $1, %esp
62
63.macro abc arg:vararg=nop
64  \arg
65.endm
66
67.macro abcd arg0=%eax, arg1:vararg=%ebx
68  movl \arg0, \arg1
69.endm
70
71.text
72
73// CHECK: nop
74  abc
75// CHECK: movl %eax, %ebx
76  abcd ,
77
78.macro .make_macro start, end, name, body:vararg
79\start \name
80\body
81\end
82.endmacro
83
84.make_macro .macro,.endmacro,.mybyte,.byte $0, $2, $1
85
86.data
87// CHECK: .byte 10
88// CHECK: .byte 12
89// CHECK: .byte 11
90.mybyte 10,11,12
91