Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / AsmParser / macro-arg.s
bloba269873e9fa1cf0a1d13ea12e3ddbe6095627b7d
1 # RUN: llvm-mc -triple=x86_64 %s | FileCheck %s
3 .macro empty, cond
4 .endm
5 empty ne
7 # CHECK: .ascii "3 \003"
8 .macro escape a
9 .ascii "\a \\a"
10 .endm
11 escape 3
13 .macro double first = -1, second = -1
14 .long \first
15 .long \second
16 .endm
18 # CHECK: .long -1
19 # CHECK-NEXT: .long -1
20 # CHECK-EMPTY:
21 double
22 # CHECK: .long -1
23 # CHECK-NEXT: .long -1
24 # CHECK-EMPTY:
25 double ,
26 # CHECK: .long 1
27 # CHECK-NEXT: .long -1
28 double 1
29 # CHECK: .long 2
30 # CHECK-NEXT: .long 3
31 double 2, 3
32 # CHECK: .long -1
33 # CHECK-NEXT: .long 4
34 double , 4
35 # CHECK: .long 5
36 # CHECK-NEXT: .long 6
37 double 5, second = 6
38 # CHECK: .long 7
39 # CHECK-NEXT: .long -1
40 double first = 7
41 # CHECK: .long -1
42 # CHECK-NEXT: .long 8
43 double second = 8
44 # CHECK: .long 10
45 # CHECK-NEXT: .long 9
46 double second = 9, first = 10
47 # CHECK: .long second+11
48 # CHECK-NEXT: .long -1
49 double second + 11
50 # CHECK: .long -1
51 # CHECK-NEXT: .long second+12
52 double , second + 12
53 # CHECK: .long second
54 # CHECK-NEXT: .long -1
55 double second
57 .macro mixed arg0 = 0, arg1 = 1 arg2 = 2, arg3 = 3
58 .long \arg0
59 .long \arg1
60 .long \arg2
61 .long \arg3
62 .endm
64 # CHECK: .long 1
65 # CHECK-NEXT: .long 2
66 # CHECK-NEXT: .long 3
67 # CHECK-NEXT: .long 3
68 mixed 1, 2 3
70 # CHECK: .long 1
71 # CHECK-NEXT: .long 2
72 # CHECK-NEXT: .long 3
73 # CHECK-NEXT: .long 3
74 mixed 1 2, 3
76 # CHECK: .long 1
77 # CHECK-NEXT: .long 2
78 # CHECK-NEXT: .long 3
79 # CHECK-NEXT: .long 4
80 mixed 1 2, 3 4
82 .macro ascii3 _a _b _c
83 .ascii "\_a|\_b|\_c"
84 .endm
86 ## 3 arguments.
87 # CHECK: .ascii "a|b|c"
88 ascii3 a, b, c
89 # CHECK: .ascii "%1|%2|%3"
90 ascii3 %1 %2 %3
91 # CHECK: .ascii "1|2|3"
92 ascii3 1, 2,3
93 # CHECK: .ascii "1|2|3"
94 ascii3 1,2 3
95 # CHECK: .ascii "1|2|3"
96 ascii3 1 2, 3
97 # CHECK: .ascii "x-y|z|1"
98 ascii3 x - y z 1
100 ## 2 arguments.
101 # CHECK: .ascii "1|(2 3)|"
102 ascii3 1, (2 3)
103 # CHECK: .ascii "1|(2 3)|"
104 ascii3 1 (2 3)