blob: 5bbc80b9398b276843f8464b058b0dfa3b323854 [file] [log] [blame]
Eli Friedmanc3e0fb42011-07-08 23:31:17 +00001// RUN: %clang_cc1 -w -fblocks -triple i386-apple-darwin9 -target-cpu yonah -emit-llvm -o - %s | FileCheck %s
Daniel Dunbare06a75f2009-03-11 22:05:26 +00002
Daniel Dunbard0ef54c2010-04-21 19:34:17 +00003// CHECK: define signext i8 @f0()
Daniel Dunbare06a75f2009-03-11 22:05:26 +00004char f0(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +00005 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +00006}
7
Daniel Dunbard0ef54c2010-04-21 19:34:17 +00008// CHECK: define signext i16 @f1()
Daniel Dunbare06a75f2009-03-11 22:05:26 +00009short f1(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +000010 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +000011}
12
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000013// CHECK: define i32 @f2()
Daniel Dunbare06a75f2009-03-11 22:05:26 +000014int f2(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +000015 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +000016}
17
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000018// CHECK: define float @f3()
Daniel Dunbare06a75f2009-03-11 22:05:26 +000019float f3(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +000020 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +000021}
22
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000023// CHECK: define double @f4()
Daniel Dunbare06a75f2009-03-11 22:05:26 +000024double f4(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +000025 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +000026}
27
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000028// CHECK: define x86_fp80 @f5()
Daniel Dunbare06a75f2009-03-11 22:05:26 +000029long double f5(void) {
Mike Stumpc36541e2009-07-21 20:52:43 +000030 return 0;
Daniel Dunbare06a75f2009-03-11 22:05:26 +000031}
32
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000033// CHECK: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4)
Mike Stumpc36541e2009-07-21 20:52:43 +000034void f6(char a0, short a1, int a2, long long a3, void *a4) {}
Daniel Dunbare06a75f2009-03-11 22:05:26 +000035
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000036// CHECK: define void @f7(i32 %a0)
37typedef enum { A, B, C } e7;
38void f7(e7 a0) {}
Daniel Dunbare06a75f2009-03-11 22:05:26 +000039
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000040// CHECK: define i64 @f8_1()
41// CHECK: define void @f8_2(i32 %a0.0, i32 %a0.1)
Daniel Dunbare06a75f2009-03-11 22:05:26 +000042struct s8 {
43 int a;
44 int b;
45};
Mike Stumpc36541e2009-07-21 20:52:43 +000046struct s8 f8_1(void) { while (1) {} }
47void f8_2(struct s8 a0) {}
Daniel Dunbare06a75f2009-03-11 22:05:26 +000048
49// This should be passed just as s8.
50
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000051// CHECK: define i64 @f9_1()
Daniel Dunbarcf6bde32009-04-01 07:45:00 +000052
Daniel Dunbareedd2922009-05-08 20:55:49 +000053// FIXME: llvm-gcc expands this, this may have some value for the
54// backend in terms of optimization but doesn't change the ABI.
Chris Lattnerde92d732011-05-22 23:35:00 +000055// CHECK: define void @f9_2(%struct.s9* byval align 4 %a0)
Daniel Dunbare06a75f2009-03-11 22:05:26 +000056struct s9 {
57 int a : 17;
58 int b;
59};
Mike Stumpc36541e2009-07-21 20:52:43 +000060struct s9 f9_1(void) { while (1) {} }
61void f9_2(struct s9 a0) {}
Daniel Dunbare06a75f2009-03-11 22:05:26 +000062
Daniel Dunbardfc6b802009-04-01 07:08:38 +000063// Return of small structures and unions
Daniel Dunbar5bde6f42009-03-31 19:01:39 +000064
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000065// CHECK: float @f10()
Daniel Dunbar5bde6f42009-03-31 19:01:39 +000066struct s10 {
67 union { };
68 float f;
Mike Stumpc36541e2009-07-21 20:52:43 +000069} f10(void) { while (1) {} }
Daniel Dunbar5bde6f42009-03-31 19:01:39 +000070
Daniel Dunbardfc6b802009-04-01 07:08:38 +000071// Small vectors and 1 x {i64,double} are returned in registers
Daniel Dunbar5bde6f42009-03-31 19:01:39 +000072
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000073// CHECK: i32 @f11()
John McCall410ffb22011-08-25 23:04:34 +000074// CHECK: void @f12(<2 x i32>* noalias sret %agg.result)
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000075// CHECK: i64 @f13()
76// CHECK: i64 @f14()
77// CHECK: <2 x i64> @f15()
78// CHECK: <2 x i64> @f16()
Daniel Dunbar36043162009-04-01 06:13:08 +000079typedef short T11 __attribute__ ((vector_size (4)));
Mike Stumpc36541e2009-07-21 20:52:43 +000080T11 f11(void) { while (1) {} }
Daniel Dunbar36043162009-04-01 06:13:08 +000081typedef int T12 __attribute__ ((vector_size (8)));
Mike Stumpc36541e2009-07-21 20:52:43 +000082T12 f12(void) { while (1) {} }
Daniel Dunbar36043162009-04-01 06:13:08 +000083typedef long long T13 __attribute__ ((vector_size (8)));
Mike Stumpc36541e2009-07-21 20:52:43 +000084T13 f13(void) { while (1) {} }
Daniel Dunbar36043162009-04-01 06:13:08 +000085typedef double T14 __attribute__ ((vector_size (8)));
Mike Stumpc36541e2009-07-21 20:52:43 +000086T14 f14(void) { while (1) {} }
Daniel Dunbardfc6b802009-04-01 07:08:38 +000087typedef long long T15 __attribute__ ((vector_size (16)));
Mike Stumpc36541e2009-07-21 20:52:43 +000088T15 f15(void) { while (1) {} }
Daniel Dunbardfc6b802009-04-01 07:08:38 +000089typedef double T16 __attribute__ ((vector_size (16)));
Mike Stumpc36541e2009-07-21 20:52:43 +000090T16 f16(void) { while (1) {} }
Daniel Dunbardfc6b802009-04-01 07:08:38 +000091
92// And when the single element in a struct (but not for 64 and
93// 128-bits).
94
Daniel Dunbard0ef54c2010-04-21 19:34:17 +000095// CHECK: i32 @f17()
John McCall410ffb22011-08-25 23:04:34 +000096// CHECK: void @f18(%{{.*}}* noalias sret %agg.result)
97// CHECK: void @f19(%{{.*}}* noalias sret %agg.result)
98// CHECK: void @f20(%{{.*}}* noalias sret %agg.result)
99// CHECK: void @f21(%{{.*}}* noalias sret %agg.result)
100// CHECK: void @f22(%{{.*}}* noalias sret %agg.result)
Mike Stumpc36541e2009-07-21 20:52:43 +0000101struct { T11 a; } f17(void) { while (1) {} }
102struct { T12 a; } f18(void) { while (1) {} }
103struct { T13 a; } f19(void) { while (1) {} }
104struct { T14 a; } f20(void) { while (1) {} }
105struct { T15 a; } f21(void) { while (1) {} }
106struct { T16 a; } f22(void) { while (1) {} }
Daniel Dunbardfc6b802009-04-01 07:08:38 +0000107
108// Single element structures are handled specially
109
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000110// CHECK: float @f23()
111// CHECK: float @f24()
112// CHECK: float @f25()
Mike Stumpc36541e2009-07-21 20:52:43 +0000113struct { float a; } f23(void) { while (1) {} }
114struct { float a[1]; } f24(void) { while (1) {} }
115struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} }
Daniel Dunbar36043162009-04-01 06:13:08 +0000116
Daniel Dunbarcf6bde32009-04-01 07:45:00 +0000117// Small structures are handled recursively
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000118// CHECK: i32 @f26()
John McCall410ffb22011-08-25 23:04:34 +0000119// CHECK: void @f27(%struct.s27* noalias sret %agg.result)
Mike Stumpc36541e2009-07-21 20:52:43 +0000120struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} }
121struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} }
Daniel Dunbarcf6bde32009-04-01 07:45:00 +0000122
John McCall410ffb22011-08-25 23:04:34 +0000123// CHECK: void @f28(%struct.s28* noalias sret %agg.result)
Mike Stumpc36541e2009-07-21 20:52:43 +0000124struct s28 { int a; int b[]; } f28(void) { while (1) {} }
Daniel Dunbarf7fff322009-05-08 20:21:04 +0000125
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000126// CHECK: define i16 @f29()
Mike Stumpc36541e2009-07-21 20:52:43 +0000127struct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} }
Daniel Dunbar8e034442009-04-27 18:31:32 +0000128
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000129// CHECK: define i16 @f30()
Mike Stumpc36541e2009-07-21 20:52:43 +0000130struct s30 { char a; char b : 4; } f30(void) { while (1) {} }
Daniel Dunbareedd2922009-05-08 20:55:49 +0000131
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000132// CHECK: define float @f31()
Mike Stumpc36541e2009-07-21 20:52:43 +0000133struct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} }
Daniel Dunbarfcab2ca2009-05-08 21:04:47 +0000134
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000135// CHECK: define i32 @f32()
Mike Stumpc36541e2009-07-21 20:52:43 +0000136struct s32 { char a; unsigned : 0; } f32(void) { while (1) {} }
Daniel Dunbar2e001162009-05-08 21:30:11 +0000137
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000138// CHECK: define float @f33()
Mike Stumpc36541e2009-07-21 20:52:43 +0000139struct s33 { float a; long long : 0; } f33(void) { while (1) {} }
Daniel Dunbar2e001162009-05-08 21:30:11 +0000140
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000141// CHECK: define float @f34()
Mike Stumpc36541e2009-07-21 20:52:43 +0000142struct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} }
Daniel Dunbar573b9072009-05-11 18:58:49 +0000143
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000144// CHECK: define i16 @f35()
Mike Stumpc36541e2009-07-21 20:52:43 +0000145struct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} }
Daniel Dunbar573b9072009-05-11 18:58:49 +0000146
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000147// CHECK: define i16 @f36()
Mike Stumpc36541e2009-07-21 20:52:43 +0000148struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} }
Daniel Dunbarcc401dc2009-05-11 23:01:34 +0000149
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000150// CHECK: define float @f37()
Mike Stumpc36541e2009-07-21 20:52:43 +0000151struct s37 { float c[1][1]; } f37(void) { while (1) {} }
Daniel Dunbarcc401dc2009-05-11 23:01:34 +0000152
John McCall410ffb22011-08-25 23:04:34 +0000153// CHECK: define void @f38(%struct.s38* noalias sret %agg.result)
Mike Stumpc36541e2009-07-21 20:52:43 +0000154struct s38 { char a[3]; short b; } f38(void) { while (1) {} }
Daniel Dunbar836a0642009-05-12 17:00:20 +0000155
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000156// CHECK: define void @f39(%struct.s39* byval align 16 %x)
Eli Friedmana1e6de92009-06-13 21:37:10 +0000157typedef int v39 __attribute((vector_size(16)));
158struct s39 { v39 x; };
159void f39(struct s39 x) {}
160
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000161// <rdar://problem/7247671>
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000162// CHECK: define i32 @f40()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000163enum e40 { ec0 = 0 };
164enum e40 f40(void) { }
165
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000166// CHECK: define void ()* @f41()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000167typedef void (^vvbp)(void);
168vvbp f41(void) { }
169
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000170// CHECK: define i32 @f42()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000171struct s42 { enum e40 f0; } f42(void) { }
172
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000173// CHECK: define i64 @f43()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000174struct s43 { enum e40 f0; int f1; } f43(void) { }
175
Eli Friedmanbd4d3bc2011-11-18 01:25:50 +0000176// CHECK: define void ()* @f44()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000177struct s44 { vvbp f0; } f44(void) { }
178
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000179// CHECK: define i64 @f45()
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000180struct s45 { vvbp f0; int f1; } f45(void) { }
181
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000182// CHECK: define void @f46(i32 %a0)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000183void f46(enum e40 a0) { }
184
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000185// CHECK: define void @f47(void ()* %a1)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000186void f47(vvbp a1) { }
187
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000188// CHECK: define void @f48(i32 %a0.0)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000189struct s48 { enum e40 f0; };
190void f48(struct s48 a0) { }
191
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000192// CHECK: define void @f49(i32 %a0.0, i32 %a0.1)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000193struct s49 { enum e40 f0; int f1; };
194void f49(struct s49 a0) { }
195
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000196// CHECK: define void @f50(void ()* %a0.0)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000197struct s50 { vvbp f0; };
198void f50(struct s50 a0) { }
199
Daniel Dunbard0ef54c2010-04-21 19:34:17 +0000200// CHECK: define void @f51(void ()* %a0.0, i32 %a0.1)
Daniel Dunbar55e59e12009-09-24 05:12:36 +0000201struct s51 { vvbp f0; int f1; };
202void f51(struct s51 a0) { }
203
Daniel Dunbare59d8582010-09-16 20:42:06 +0000204// CHECK: define void @f52(%struct.s52* byval align 4)
Daniel Dunbar46c54fb2010-04-21 19:49:55 +0000205struct s52 {
206 long double a;
207};
208void f52(struct s52 x) {}
209
Daniel Dunbare59d8582010-09-16 20:42:06 +0000210// CHECK: define void @f53(%struct.s53* byval align 4)
Daniel Dunbar46c54fb2010-04-21 19:49:55 +0000211struct __attribute__((aligned(32))) s53 {
212 int x;
213 int y;
214};
215void f53(struct s53 x) {}
Chris Lattnerbbae8b42010-08-26 20:05:13 +0000216
217typedef unsigned short v2i16 __attribute__((__vector_size__(4)));
218
219// CHECK: define i32 @f54(i32 %arg.coerce)
Chris Lattner2e29a992010-08-26 20:05:48 +0000220// rdar://8359483
Chris Lattnerbbae8b42010-08-26 20:05:13 +0000221v2i16 f54(v2i16 arg) { return arg+arg; }
222
Chris Lattner4599f342010-08-30 22:03:23 +0000223
224typedef int v4i32 __attribute__((__vector_size__(16)));
225
226// CHECK: define <2 x i64> @f55(<4 x i32> %arg)
227// PR8029
228v4i32 f55(v4i32 arg) { return arg+arg; }
229
Daniel Dunbar93ae9472010-09-16 20:42:00 +0000230// CHECK: define void @f56(
Chris Lattnerde92d732011-05-22 23:35:00 +0000231// CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
Bill Wendlingbb465d72010-10-18 03:41:31 +0000232// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
Daniel Dunbare59d8582010-09-16 20:42:06 +0000233// CHECK: i64 %a4.coerce, %struct.s56_2* byval align 4,
Chris Lattner9cbe4f02011-07-09 17:41:47 +0000234// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7,
Daniel Dunbar93ae9472010-09-16 20:42:00 +0000235// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
Daniel Dunbare59d8582010-09-16 20:42:06 +0000236// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
237// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
Daniel Dunbar93ae9472010-09-16 20:42:00 +0000238
239// CHECK: call void (i32, ...)* @f56_0(i32 1,
Chris Lattnerde92d732011-05-22 23:35:00 +0000240// CHECK: i32 %{{[^ ]*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
Bill Wendlingbb465d72010-10-18 03:41:31 +0000241// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
Daniel Dunbare59d8582010-09-16 20:42:06 +0000242// CHECK: i64 %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
Chris Lattner9cbe4f02011-07-09 17:41:47 +0000243// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 16 %{{[^ ]*}},
Daniel Dunbar93ae9472010-09-16 20:42:00 +0000244// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}},
Daniel Dunbare59d8582010-09-16 20:42:06 +0000245// CHECK: <8 x i32> {{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
246// CHECK: <4 x double> {{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
Daniel Dunbar93ae9472010-09-16 20:42:00 +0000247// CHECK: }
248//
249// <rdar://problem/7964854> [i386] clang misaligns long double in structures
250// when passed byval
251// <rdar://problem/8431367> clang misaligns parameters on stack
252typedef int __attribute__((vector_size (8))) t56_v2i;
253typedef double __attribute__((vector_size (8))) t56_v1d;
254typedef int __attribute__((vector_size (16))) t56_v4i;
255typedef double __attribute__((vector_size (16))) t56_v2d;
256typedef int __attribute__((vector_size (32))) t56_v8i;
257typedef double __attribute__((vector_size (32))) t56_v4d;
258
259struct s56_0 { char a; };
260struct s56_1 { t56_v2i a; };
261struct s56_2 { t56_v1d a; };
262struct s56_3 { t56_v4i a; };
263struct s56_4 { t56_v2d a; };
264struct s56_5 { t56_v8i a; };
265struct s56_6 { t56_v4d a; };
266
267void f56(char a0, struct s56_0 a1,
268 t56_v2i a2, struct s56_1 a3,
269 t56_v1d a4, struct s56_2 a5,
270 t56_v4i a6, struct s56_3 a7,
271 t56_v2d a8, struct s56_4 a9,
272 t56_v8i a10, struct s56_5 a11,
273 t56_v4d a12, struct s56_6 a13) {
274 extern void f56_0(int x, ...);
275 f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
276 a10, a11, a12, a13);
277}
Eli Friedmanca3d3fc2011-11-15 02:46:03 +0000278
279// CHECK: define void @f57(i32 %x.0, i32 %x.1)
280// CHECK: call void @f57(
281struct s57 { _Complex int x; };
282void f57(struct s57 x) {} void f57a(void) { f57((struct s57){1}); }
Eli Friedman5a4d3522011-11-18 00:28:11 +0000283
Eli Friedmanbd4d3bc2011-11-18 01:25:50 +0000284// CHECK: define void @f58()
Eli Friedman5a4d3522011-11-18 00:28:11 +0000285union u58 {};
286void f58(union u58 x) {}
Eli Friedmanbd4d3bc2011-11-18 01:25:50 +0000287
288// CHECK: define i64 @f59()
289struct s59 { float x __attribute((aligned(8))); };
290struct s59 f59() { while (1) {} }
Eli Friedman506d4e32011-11-18 01:32:26 +0000291
292// CHECK: define void @f60(%struct.s60* byval align 4, i32 %y)
293struct s60 { int x __attribute((aligned(8))); };
294void f60(struct s60 x, int y) {}
Eli Friedman7b1fb812011-11-18 02:12:09 +0000295
296// CHECK: define void @f61(i32 %x, %struct.s61* byval align 16 %y)
297typedef int T61 __attribute((vector_size(16)));
298struct s61 { T61 x; int y; };
299void f61(int x, struct s61 y) {}
300
301// CHECK: define void @f62(i32 %x, %struct.s62* byval align 4)
302typedef int T62 __attribute((vector_size(16)));
303struct s62 { T62 x; int y; } __attribute((packed, aligned(8)));
304void f62(int x, struct s62 y) {}
305
306// CHECK: define i32 @f63
307// CHECK: ptrtoint
308// CHECK: and {{.*}}, -16
309// CHECK: inttoptr
310typedef int T63 __attribute((vector_size(16)));
311struct s63 { T63 x; int y; };
312int f63(int i, ...) {
313 __builtin_va_list ap;
314 __builtin_va_start(ap, i);
315 struct s63 s = __builtin_va_arg(ap, struct s63);
316 __builtin_va_end(ap);
317 return s.y;
318}
Eli Friedman7e7ad3f2011-11-18 03:47:20 +0000319
Eli Friedman5a1ac892011-11-18 04:01:36 +0000320// CHECK: define void @f64(%struct.s64* byval align 4 %x)
Eli Friedman7e7ad3f2011-11-18 03:47:20 +0000321struct s64 { signed char a[0]; signed char b[]; };
322void f64(struct s64 x) {}
323
324// CHECK: define float @f65()
325struct s65 { signed char a[0]; float b; };
326struct s65 f65() { return (struct s65){{},2}; }
Eli Friedmanf4bd4d82012-06-05 19:40:46 +0000327
328// CHECK: define <2 x i64> @f66
329// CHECK: ptrtoint
330// CHECK: and {{.*}}, -16
331// CHECK: inttoptr
332typedef int T66 __attribute((vector_size(16)));
333T66 f66(int i, ...) {
334 __builtin_va_list ap;
335 __builtin_va_start(ap, i);
336 T66 v = __builtin_va_arg(ap, T66);
337 __builtin_va_end(ap);
338 return v;
339}