This is a patch to the assembler frontend to detect when aligning a text
[oota-llvm.git] / test / MC / MachO / Darwin / optimal_nop.s
1 // Validate that we can assemble this file exactly like the platform
2 // assembler.
3 //
4 // RUN: llvm-mc -filetype=obj -triple i386-apple-darwin10 -o %t.mc.o %s
5 // RUN: as -arch i386 -o %t.as.o %s
6 // RUN: diff %t.mc.o %t.as.o
7
8 # 1 byte nop test
9         .align 4, 0 # start with 16 byte alignment filled with zeros
10         ret
11         # nop
12         # 0x90
13         .align 1, 0x90
14         ret
15 # 2 byte nop test
16         .align 4, 0 # start with 16 byte alignment filled with zeros
17         ret
18         ret
19         # xchg %ax,%ax
20         # 0x66, 0x90
21         .align 2, 0x90
22         ret
23 # 3 byte nop test
24         .align 4, 0 # start with 16 byte alignment filled with zeros
25         ret
26         # nopl (%[re]ax)
27         # 0x0f, 0x1f, 0x00
28         .align 2, 0x90
29         ret
30 # 4 byte nop test
31         .align 4, 0 # start with 16 byte alignment filled with zeros
32         ret
33         ret
34         ret
35         ret
36         # nopl 0(%[re]ax)
37         # 0x0f, 0x1f, 0x40, 0x00
38         .align 3, 0x90
39         ret
40 # 5 byte nop test
41         .align 4, 0 # start with 16 byte alignment filled with zeros
42         ret
43         ret
44         ret
45         # nopl 0(%[re]ax,%[re]ax,1)
46         # 0x0f, 0x1f, 0x44, 0x00, 0x00
47         .align 3, 0x90
48         ret
49 # 6 byte nop test
50         .align 4, 0 # start with 16 byte alignment filled with zeros
51         ret
52         ret
53         # nopw 0(%[re]ax,%[re]ax,1)
54         # 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00
55         .align 3, 0x90
56         ret
57 # 7 byte nop test
58         .align 4, 0 # start with 16 byte alignment filled with zeros
59         ret
60         # nopl 0L(%[re]ax)
61         # 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
62         .align 3, 0x90
63         ret
64 # 8 byte nop test
65         .align 4, 0 # start with 16 byte alignment filled with zeros
66         ret
67         ret
68         ret
69         ret
70         ret
71         ret
72         ret
73         ret
74         # nopl 0L(%[re]ax,%[re]ax,1)
75         # 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
76         .align 3, 0x90
77         ret
78 # 9 byte nop test
79         .align 4, 0 # start with 16 byte alignment filled with zeros
80         ret
81         ret
82         ret
83         ret
84         ret
85         ret
86         ret
87         # nopw 0L(%[re]ax,%[re]ax,1)
88         # 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
89         .align 4, 0x90
90         ret
91 # 10 byte nop test
92         .align 4, 0 # start with 16 byte alignment filled with zeros
93         ret
94         ret
95         ret
96         ret
97         ret
98         ret
99         ret
100         # nopw %cs:0L(%[re]ax,%[re]ax,1)
101         # 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
102         .align 4, 0x90
103         ret
104 # 11 byte nop test
105         .align 4, 0 # start with 16 byte alignment filled with zeros
106         ret
107         ret
108         ret
109         ret
110         ret
111         # nopw %cs:0L(%[re]ax,%[re]ax,1)
112         # 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
113         .align 4, 0x90
114         ret
115 # 12 byte nop test
116         .align 4, 0 # start with 16 byte alignment filled with zeros
117         ret
118         ret
119         ret
120         ret
121         # nopw 0(%[re]ax,%[re]ax,1)
122         # nopw 0(%[re]ax,%[re]ax,1)
123         # 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00,
124         # 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00
125         .align 4, 0x90
126         ret
127 # 13 byte nop test
128         .align 4, 0 # start with 16 byte alignment filled with zeros
129         ret
130         ret
131         ret
132         # nopw 0(%[re]ax,%[re]ax,1)
133         # nopl 0L(%[re]ax)
134         # 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00,
135         # 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
136         .align 4, 0x90
137         ret
138 # 14 byte nop test
139         .align 4, 0 # start with 16 byte alignment filled with zeros
140         ret
141         ret
142         # nopl 0L(%[re]ax)
143         # nopl 0L(%[re]ax)
144         # 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00,
145         # 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
146         .align 4, 0x90
147         ret
148 # 15 byte nop test
149         .align 4, 0 # start with 16 byte alignment filled with zeros
150         ret
151         # nopl 0L(%[re]ax)
152         # nopl 0L(%[re]ax,%[re]ax,1)
153         # 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00,
154         # 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00
155         .align 4, 0x90
156         ret