summaryrefslogtreecommitdiffstats
path: root/test/MC/AsmParser/macros-darwin-vararg.s
blob: 4aa2f4c1d9b6dc547a000048c143217bc69f2358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// RUN: llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s

.macro abc a b:vararg
.globl "\a, \b"
.endm

// CHECK: .globl "zed0, zed1, zed2"
abc zed0, zed1, zed2

.purgem abc

.macro ifcc arg:vararg
.if cc
            \arg
.endif
.endm

.macro ifcc2 arg0 arg1:vararg
.if cc
            movl \arg0, \arg1
.endif
.endm

.macro ifcc3 arg0, arg1:vararg
.if cc
            movl \arg0, \arg1
.endif
.endm

.macro ifcc4 arg0, arg1:vararg
.if cc
            movl \arg1, \arg0
.endif
.endm

.text

// CHECK: movl %esp, %ebp
// CHECK: subl $0, %esp
// CHECK: movl %eax, %ebx
// CHECK: movl %ecx, %ebx
// CHECK: movl %ecx, %eax
// CHECK: movl %eax, %ecx
// CHECK: movl %ecx, %eax
// CHECK: movl %eax, %ecx
.set cc,1
  ifcc  movl    %esp, %ebp
        subl $0, %esp

  ifcc2 %eax, %ebx
  ifcc2 %ecx, %ebx
  ifcc3 %ecx, %eax
  ifcc3 %eax, %ecx
  ifcc4 %eax, %ecx  ## test
  ifcc4 %ecx, %eax ## test

// CHECK-NOT movl
// CHECK: subl $1, %esp
.set cc,0
  ifcc  movl,    %esp, %ebp
        subl $1, %esp

.macro abc arg:vararg=nop
  \arg
.endm

.macro abcd arg0=%eax, arg1:vararg=%ebx
  movl \arg0, \arg1
.endm

.text

// CHECK: nop
  abc
// CHECK: movl %eax, %ebx
  abcd ,

.macro .make_macro start, end, name, body:vararg
\start \name
\body
\end
.endmacro

.make_macro .macro,.endmacro,.mybyte,.byte $0, $2, $1

.data
// CHECK: .byte 10
// CHECK: .byte 12
// CHECK: .byte 11
.mybyte 10,11,12