Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-ml / struct.asm
blob7fb22fe2a0aa9d5365eb0a703ad880cf3c6a3028
1 ; RUN: llvm-ml -m64 -filetype=s %s /Fo - | FileCheck %s
3 .data
4 BAZ STRUCT
5 a BYTE 1
6 b BYTE 2
7 BAZ ENDS
9 FOOBAR struct 2
10 c BYTE 3 DUP (4)
11 d DWORD 5
12 e BAZ <>
13 STRUCT f
14 g BYTE 6
15 h BYTE 7
16 ends
17 h BYTE "abcde"
18 foobar ENDS
20 t1 foobar <>
22 ; CHECK: t1:
24 ; BYTE 3 DUP (4), plus alignment padding
25 ; CHECK-NEXT: .byte 4
26 ; CHECK-NEXT: .byte 4
27 ; CHECK-NEXT: .byte 4
28 ; CHECK-NEXT: .zero 1
30 ; DWORD 5
31 ; CHECK-NEXT: .long 5
33 ; BAZ <>
34 ; CHECK-NEXT: .byte 1
35 ; CHECK-NEXT: .byte 2
37 ; <BYTE 6, BYTE 7>, with no alignment padding (field size < alignment)
38 ; CHECK-NEXT: .byte 6
39 ; CHECK-NEXT: .byte 7
41 ; BYTE "abcde", plus alignment padding
42 ; CHECK-NEXT: .byte 97
43 ; CHECK-NEXT: .byte 98
44 ; CHECK-NEXT: .byte 99
45 ; CHECK-NEXT: .byte 100
46 ; CHECK-NEXT: .byte 101
47 ; CHECK-NEXT: .zero 1
49 t2 FOOBAR <"gh",,<10,11>,<12>,'ijk'>
51 ; CHECK: t2:
53 ; BYTE "gh", padded with " ", plus alignment padding
54 ; CHECK-NEXT: .byte 103
55 ; CHECK-NEXT: .byte 104
56 ; CHECK-NEXT: .byte 32
57 ; CHECK-NEXT: .zero 1
59 ; DWORD 5 (default-initialized when omitted)
60 ; CHECK-NEXT: .long 5
62 ; BAZ <10, 11>
63 ; CHECK-NEXT: .byte 10
64 ; CHECK-NEXT: .byte 11
66 ; <BYTE 12, BYTE 7>, with no alignment padding (field size < alignment)
67 ; CHECK-NEXT: .byte 12
68 ; CHECK-NEXT: .byte 7
70 ; BYTE "ijk", padded with " ", plus alignment padding
71 ; CHECK-NEXT: .byte 105
72 ; CHECK-NEXT: .byte 106
73 ; CHECK-NEXT: .byte 107
74 ; CHECK-NEXT: .byte 32
75 ; CHECK-NEXT: .byte 32
76 ; CHECK-NEXT: .zero 1
78 .code
80 t3:
81 mov al, t2.f.h
82 mov al, [t2].f.h
83 mov al, [t2.f.h]
85 ; CHECK: t3:
86 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
87 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
88 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
90 t4:
91 mov al, j.FOOBAR.f.h
92 mov al, j.baz.b
94 ; CHECK: t4:
95 ; CHECK-NEXT: mov al, byte ptr [rip + j+11]
96 ; CHECK-NEXT: mov al, byte ptr [rip + j+1]
98 t5:
99 mov al, [ebx].FOOBAR.f.h
100 mov al, [ebx.FOOBAR].f.h
101 mov al, [ebx.FOOBAR.f.h]
103 ; CHECK: t5:
104 ; CHECK-NEXT: mov al, byte ptr [ebx + 11]
105 ; CHECK-NEXT: mov al, byte ptr [ebx + 11]
106 ; CHECK-NEXT: mov al, byte ptr [ebx + 11]
109 mov al, t2.FOOBAR.f.h
110 mov al, [t2].FOOBAR.f.h
111 mov al, [t2.FOOBAR].f.h
112 mov al, [t2.FOOBAR.f.h]
114 ; CHECK: t6:
115 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
116 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
117 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
118 ; CHECK-NEXT: mov al, byte ptr [rip + t2+11]
121 mov al, [ebx].FOOBAR.e.b
122 mov al, [ebx.FOOBAR].e.b
123 mov al, [ebx.FOOBAR.e].b
124 mov al, [ebx.FOOBAR.e.b]
126 ; CHECK: t7:
127 ; CHECK-NEXT: mov al, byte ptr [ebx + 9]
128 ; CHECK-NEXT: mov al, byte ptr [ebx + 9]
129 ; CHECK-NEXT: mov al, byte ptr [ebx + 9]
130 ; CHECK-NEXT: mov al, byte ptr [ebx + 9]
133 mov al, t2.FOOBAR.e.b
134 mov al, [t2].FOOBAR.e.b
135 mov al, [t2.FOOBAR].e.b
136 mov al, [t2.FOOBAR.e].b
137 mov al, [t2.FOOBAR.e.b]
139 ; CHECK: t8:
140 ; CHECK-NEXT: mov al, byte ptr [rip + t2+9]
141 ; CHECK-NEXT: mov al, byte ptr [rip + t2+9]
142 ; CHECK-NEXT: mov al, byte ptr [rip + t2+9]
143 ; CHECK-NEXT: mov al, byte ptr [rip + t2+9]
144 ; CHECK-NEXT: mov al, byte ptr [rip + t2+9]
146 QUUX STRUCT
147 u DWORD ?
148 UNION
149 v WORD ?
150 w DWORD ?
151 STRUCT
152 x BYTE ?
153 y BYTE ?
154 ENDS
155 after_struct BYTE ?
156 ENDS
157 z DWORD ?
158 QUUX ENDS
161 mov eax, [ebx].QUUX.u
162 mov ax, [ebx].QUUX.v
163 mov eax, [ebx].QUUX.w
164 mov al, [ebx].QUUX.x
165 mov al, [ebx].QUUX.y
166 mov al, [ebx].QUUX.after_struct
167 mov eax, [ebx].QUUX.z
169 ; CHECK: t9:
170 ; CHECK-NEXT: mov eax, dword ptr [ebx]
171 ; CHECK-NEXT: mov ax, word ptr [ebx + 4]
172 ; CHECK-NEXT: mov eax, dword ptr [ebx + 4]
173 ; CHECK-NEXT: mov al, byte ptr [ebx + 4]
174 ; CHECK-NEXT: mov al, byte ptr [ebx + 5]
175 ; CHECK-NEXT: mov al, byte ptr [ebx + 4]
176 ; CHECK-NEXT: mov eax, dword ptr [ebx + 8]
178 t10:
179 mov eax, FOOBAR.f
180 mov eax, FOOBAR.f.h
182 ; CHECK: t10:
183 ; CHECK-NEXT: mov eax, 10
184 ; CHECK-NEXT: mov eax, 11
186 t11:
187 mov ax, (FOOBAR PTR [ebx]).f
188 mov ax, (FOOBAR PTR t1).f
190 ; CHECK: t11:
191 ; CHECK-NEXT: mov ax, word ptr [ebx + 10]
192 ; CHECK-NEXT: mov ax, word ptr [rip + t1+10]