1 // RUN: %clang_cc1 -ffreestanding -emit-llvm-only  -triple x86_64-windows-coff -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK-MS
2 // RUN: %clang_cc1 -ffreestanding -emit-llvm-only  -triple x86_64-apple-darwin -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK-NOTMS
3 #include <x86intrin.h>
4 
5 #pragma pack(1)
6 
7 struct s_m64 {
8   int a;
9   __m64 b;
10 };
11 typedef struct s_m64 m64;
12 
13 #if defined(_WIN32)
14 static int a1[(sizeof(m64) == 16) - 1];
15 #else
16 static int a1[(sizeof(m64) == 12) - 1];
17 #endif
18 
19 struct s_m128 {
20   int a;
21   __m128 b;
22 };
23 typedef struct s_m128 m128;
24 
25 #if defined(_WIN32)
26 static int a1[(sizeof(m128) == 32) - 1];
27 #else
28 static int a1[(sizeof(m128) == 20) - 1];
29 #endif
30 
31 struct s_m128i {
32   int a;
33   __m128i b;
34 };
35 typedef struct s_m128i m128i;
36 
37 #if defined(_WIN32)
38 static int a1[(sizeof(m128i) == 32) - 1];
39 #else
40 static int a1[(sizeof(m128i) == 20) - 1];
41 #endif
42 
43 struct s_m128d {
44   int a;
45   __m128d b;
46 };
47 typedef struct s_m128d m128d;
48 
49 #if defined(_WIN32)
50 static int a1[(sizeof(m128d) == 32) - 1];
51 #else
52 static int a1[(sizeof(m128d) == 20) - 1];
53 #endif
54 
55 struct s_m256 {
56   int a;
57   __m256 b;
58 };
59 typedef struct s_m256 m256;
60 
61 #if defined(_WIN32)
62 static int a1[(sizeof(m256) == 64) - 1];
63 #else
64 static int a1[(sizeof(m256) == 36) - 1];
65 #endif
66 
67 struct s_m256i {
68   int a;
69   __m256i b;
70 };
71 typedef struct s_m256i m256i;
72 
73 #if defined(_WIN32)
74 static int a1[(sizeof(m256i) == 64) - 1];
75 #else
76 static int a1[(sizeof(m256i) == 36) - 1];
77 #endif
78 
79 struct s_m256d {
80   int a;
81   __m256d b;
82 };
83 typedef struct s_m256d m256d;
84 
85 #if defined(_WIN32)
86 static int a1[(sizeof(m256d) == 64) - 1];
87 #else
88 static int a1[(sizeof(m256d) == 36) - 1];
89 #endif
90 
91 struct s_m512 {
92   int a;
93   __m512 b;
94 };
95 typedef struct s_m512 m512;
96 
97 #if defined(_WIN32)
98 static int a1[(sizeof(m512) == 128) - 1];
99 #else
100 static int a1[(sizeof(m512) == 68) - 1];
101 #endif
102 
103 struct s_m512i {
104   int a;
105   __m512i b;
106 };
107 typedef struct s_m512i m512i;
108 
109 #if defined(_WIN32)
110 static int a1[(sizeof(m512i) == 128) - 1];
111 #else
112 static int a1[(sizeof(m512i) == 68) - 1];
113 #endif
114 
115 struct s_m512d {
116   int a;
117   __m512d b;
118 };
119 typedef struct s_m512d m512d;
120 
121 #if defined(_WIN32)
122 static int a1[(sizeof(m512d) == 128) - 1];
123 #else
124 static int a1[(sizeof(m512d) == 68) - 1];
125 #endif
126 
127 // CHECK-MS: *** Dumping AST Record Layout
128 // CHECK-MS:          0 | struct s_m64
129 // CHECK-MS:          0 |   int a
130 // CHECK-MS:          8 |   __m64 b
131 // CHECK-MS:            | [sizeof=16, align=8]
132 // CHECK-MS: *** Dumping AST Record Layout
133 // CHECK-MS:          0 | struct s_m128
134 // CHECK-MS:          0 |   int a
135 // CHECK-MS:         16 |   __m128 b
136 // CHECK-MS:            | [sizeof=32, align=16]
137 // CHECK-MS: *** Dumping AST Record Layout
138 // CHECK-MS:          0 | struct s_m128i
139 // CHECK-MS:          0 |   int a
140 // CHECK-MS:         16 |   __m128i b
141 // CHECK-MS:            | [sizeof=32, align=16]
142 // CHECK-MS: *** Dumping AST Record Layout
143 // CHECK-MS:          0 | struct s_m128d
144 // CHECK-MS:          0 |   int a
145 // CHECK-MS:         16 |   __m128d b
146 // CHECK-MS:            | [sizeof=32, align=16]
147 // CHECK-MS: *** Dumping AST Record Layout
148 // CHECK-MS:          0 | struct s_m256
149 // CHECK-MS:          0 |   int a
150 // CHECK-MS:         32 |   __m256 b
151 // CHECK-MS:            | [sizeof=64, align=32]
152 // CHECK-MS: *** Dumping AST Record Layout
153 // CHECK-MS:          0 | struct s_m256i
154 // CHECK-MS:          0 |   int a
155 // CHECK-MS:         32 |   __m256i b
156 // CHECK-MS:            | [sizeof=64, align=32]
157 // CHECK-MS: *** Dumping AST Record Layout
158 // CHECK-MS:          0 | struct s_m256d
159 // CHECK-MS:          0 |   int a
160 // CHECK-MS:         32 |   __m256d b
161 // CHECK-MS:            | [sizeof=64, align=32]
162 // CHECK-MS: *** Dumping AST Record Layout
163 // CHECK-MS:          0 | struct s_m512
164 // CHECK-MS:          0 |   int a
165 // CHECK-MS:         64 |   __m512 b
166 // CHECK-MS:            | [sizeof=128, align=64]
167 // CHECK-MS: *** Dumping AST Record Layout
168 // CHECK-MS:          0 | struct s_m512i
169 // CHECK-MS:          0 |   int a
170 // CHECK-MS:         64 |   __m512i b
171 // CHECK-MS:            | [sizeof=128, align=64]
172 // CHECK-MS: *** Dumping AST Record Layout
173 // CHECK-MS:          0 | struct s_m512d
174 // CHECK-MS:          0 |   int a
175 // CHECK-MS:         64 |   __m512d b
176 // CHECK-MS:            | [sizeof=128, align=64]
177 
178 // CHECK-NOTMS: *** Dumping AST Record Layout
179 // CHECK-NOTMS:          0 | struct s_m64
180 // CHECK-NOTMS:          0 |   int a
181 // CHECK-NOTMS:          4 |   __m64 b
182 // CHECK-NOTMS:            | [sizeof=12, align=1]
183 // CHECK-NOTMS: *** Dumping AST Record Layout
184 // CHECK-NOTMS:          0 | struct s_m128
185 // CHECK-NOTMS:          0 |   int a
186 // CHECK-NOTMS:          4 |   __m128 b
187 // CHECK-NOTMS:            | [sizeof=20, align=1]
188 // CHECK-NOTMS: *** Dumping AST Record Layout
189 // CHECK-NOTMS:          0 | struct s_m128i
190 // CHECK-NOTMS:          0 |   int a
191 // CHECK-NOTMS:          4 |   __m128i b
192 // CHECK-NOTMS:            | [sizeof=20, align=1]
193 // CHECK-NOTMS: *** Dumping AST Record Layout
194 // CHECK-NOTMS:          0 | struct s_m128d
195 // CHECK-NOTMS:          0 |   int a
196 // CHECK-NOTMS:          4 |   __m128d b
197 // CHECK-NOTMS:            | [sizeof=20, align=1]
198 // CHECK-NOTMS: *** Dumping AST Record Layout
199 // CHECK-NOTMS:          0 | struct s_m256
200 // CHECK-NOTMS:          0 |   int a
201 // CHECK-NOTMS:          4 |   __m256 b
202 // CHECK-NOTMS:            | [sizeof=36, align=1]
203 // CHECK-NOTMS: *** Dumping AST Record Layout
204 // CHECK-NOTMS:          0 | struct s_m256i
205 // CHECK-NOTMS:          0 |   int a
206 // CHECK-NOTMS:          4 |   __m256i b
207 // CHECK-NOTMS:            | [sizeof=36, align=1]
208 // CHECK-NOTMS: *** Dumping AST Record Layout
209 // CHECK-NOTMS:          0 | struct s_m256d
210 // CHECK-NOTMS:          0 |   int a
211 // CHECK-NOTMS:          4 |   __m256d b
212 // CHECK-NOTMS:            | [sizeof=36, align=1]
213 // CHECK-NOTMS: *** Dumping AST Record Layout
214 // CHECK-NOTMS:          0 | struct s_m512
215 // CHECK-NOTMS:          0 |   int a
216 // CHECK-NOTMS:          4 |   __m512 b
217 // CHECK-NOTMS:            | [sizeof=68, align=1]
218 // CHECK-NOTMS: *** Dumping AST Record Layout
219 // CHECK-NOTMS:          0 | struct s_m512i
220 // CHECK-NOTMS:          0 |   int a
221 // CHECK-NOTMS:          4 |   __m512i b
222 // CHECK-NOTMS:            | [sizeof=68, align=1]
223 // CHECK-NOTMS: *** Dumping AST Record Layout
224 // CHECK-NOTMS:          0 | struct s_m512d
225 // CHECK-NOTMS:          0 |   int a
226 // CHECK-NOTMS:          4 |   __m512d b
227 // CHECK-NOTMS:            | [sizeof=68, align=1]
228