• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-ml -m64 -filetype=s %s /Fo - | FileCheck %s
2
3.data
4BAZ STRUCT
5  a BYTE 1
6  b BYTE 2
7BAZ ENDS
8
9FOOBAR 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"
18foobar ENDS
19
20t1 foobar <>
21
22; CHECK: t1:
23;
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
29;
30; DWORD 5
31; CHECK-NEXT: .long 5
32;
33; BAZ <>
34; CHECK-NEXT: .byte 1
35; CHECK-NEXT: .byte 2
36;
37; <BYTE 6, BYTE 7>, with no alignment padding (field size < alignment)
38; CHECK-NEXT: .byte 6
39; CHECK-NEXT: .byte 7
40;
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
48
49t2 FOOBAR <"gh",,<10,11>,<12>,'ijk'>
50
51; CHECK: t2:
52;
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
58;
59; DWORD 5 (default-initialized when omitted)
60; CHECK-NEXT: .long 5
61;
62; BAZ <10, 11>
63; CHECK-NEXT: .byte 10
64; CHECK-NEXT: .byte 11
65;
66; <BYTE 12, BYTE 7>, with no alignment padding (field size < alignment)
67; CHECK-NEXT: .byte 12
68; CHECK-NEXT: .byte 7
69;
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
77
78.code
79
80t3:
81mov al, t2.f.h
82mov al, [t2].f.h
83mov al, [t2.f.h]
84
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]
89
90t4:
91mov al, j.FOOBAR.f.h
92mov al, j.baz.b
93
94; CHECK: t4:
95; CHECK-NEXT: mov al, byte ptr [rip + j+11]
96; CHECK-NEXT: mov al, byte ptr [rip + j+1]
97
98t5:
99mov al, [ebx].FOOBAR.f.h
100mov al, [ebx.FOOBAR].f.h
101mov al, [ebx.FOOBAR.f.h]
102
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]
107
108t6:
109mov al, t2.FOOBAR.f.h
110mov al, [t2].FOOBAR.f.h
111mov al, [t2.FOOBAR].f.h
112mov al, [t2.FOOBAR.f.h]
113
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]
119
120t7:
121mov al, [ebx].FOOBAR.e.b
122mov al, [ebx.FOOBAR].e.b
123mov al, [ebx.FOOBAR.e].b
124mov al, [ebx.FOOBAR.e.b]
125
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]
131
132t8:
133mov al, t2.FOOBAR.e.b
134mov al, [t2].FOOBAR.e.b
135mov al, [t2.FOOBAR].e.b
136mov al, [t2.FOOBAR.e].b
137mov al, [t2.FOOBAR.e.b]
138
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]
145
146QUUX 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 ?
158QUUX ENDS
159
160t9:
161mov eax, [ebx].QUUX.u
162mov ax, [ebx].QUUX.v
163mov eax, [ebx].QUUX.w
164mov al, [ebx].QUUX.x
165mov al, [ebx].QUUX.y
166mov al, [ebx].QUUX.after_struct
167mov eax, [ebx].QUUX.z
168
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]
177
178t10:
179mov eax, FOOBAR.f
180mov eax, FOOBAR.f.h
181
182; CHECK: t10:
183; CHECK-NEXT: mov eax, 10
184; CHECK-NEXT: mov eax, 11
185
186t11:
187mov ax, (FOOBAR PTR [ebx]).f
188mov ax, (FOOBAR PTR t1).f
189
190; CHECK: t11:
191; CHECK-NEXT: mov ax, word ptr [ebx + 10]
192; CHECK-NEXT: mov ax, word ptr [rip + t1+10]
193
194END
195