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