xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/x86_32-arguments-darwin.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -w -fblocks -triple i386-apple-darwin9 -target-cpu yonah -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // CHECK-LABEL: define signext i8 @f0()
f0(void)4*f4a2713aSLionel Sambuc char f0(void) {
5*f4a2713aSLionel Sambuc   return 0;
6*f4a2713aSLionel Sambuc }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // CHECK-LABEL: define signext i16 @f1()
f1(void)9*f4a2713aSLionel Sambuc short f1(void) {
10*f4a2713aSLionel Sambuc   return 0;
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f2()
f2(void)14*f4a2713aSLionel Sambuc int f2(void) {
15*f4a2713aSLionel Sambuc   return 0;
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f3()
f3(void)19*f4a2713aSLionel Sambuc float f3(void) {
20*f4a2713aSLionel Sambuc   return 0;
21*f4a2713aSLionel Sambuc }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // CHECK-LABEL: define double @f4()
f4(void)24*f4a2713aSLionel Sambuc double f4(void) {
25*f4a2713aSLionel Sambuc   return 0;
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc // CHECK-LABEL: define x86_fp80 @f5()
f5(void)29*f4a2713aSLionel Sambuc long double f5(void) {
30*f4a2713aSLionel Sambuc   return 0;
31*f4a2713aSLionel Sambuc }
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4)
f6(char a0,short a1,int a2,long long a3,void * a4)34*f4a2713aSLionel Sambuc void f6(char a0, short a1, int a2, long long a3, void *a4) {}
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f7(i32 %a0)
37*f4a2713aSLionel Sambuc typedef enum { A, B, C } e7;
f7(e7 a0)38*f4a2713aSLionel Sambuc void f7(e7 a0) {}
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc // CHECK-LABEL: define i64 @f8_1()
41*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f8_2(i32 %a0.0, i32 %a0.1)
42*f4a2713aSLionel Sambuc struct s8 {
43*f4a2713aSLionel Sambuc   int a;
44*f4a2713aSLionel Sambuc   int b;
45*f4a2713aSLionel Sambuc };
f8_1(void)46*f4a2713aSLionel Sambuc struct s8 f8_1(void) { while (1) {} }
f8_2(struct s8 a0)47*f4a2713aSLionel Sambuc void f8_2(struct s8 a0) {}
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc // This should be passed just as s8.
50*f4a2713aSLionel Sambuc 
51*f4a2713aSLionel Sambuc // CHECK-LABEL: define i64 @f9_1()
52*f4a2713aSLionel Sambuc 
53*f4a2713aSLionel Sambuc // FIXME: llvm-gcc expands this, this may have some value for the
54*f4a2713aSLionel Sambuc // backend in terms of optimization but doesn't change the ABI.
55*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f9_2(%struct.s9* byval align 4 %a0)
56*f4a2713aSLionel Sambuc struct s9 {
57*f4a2713aSLionel Sambuc   int a : 17;
58*f4a2713aSLionel Sambuc   int b;
59*f4a2713aSLionel Sambuc };
f9_1(void)60*f4a2713aSLionel Sambuc struct s9 f9_1(void) { while (1) {} }
f9_2(struct s9 a0)61*f4a2713aSLionel Sambuc void f9_2(struct s9 a0) {}
62*f4a2713aSLionel Sambuc 
63*f4a2713aSLionel Sambuc // Return of small structures and unions
64*f4a2713aSLionel Sambuc 
65*f4a2713aSLionel Sambuc // CHECK: float @f10()
66*f4a2713aSLionel Sambuc struct s10 {
67*f4a2713aSLionel Sambuc   union { };
68*f4a2713aSLionel Sambuc   float f;
f10(void)69*f4a2713aSLionel Sambuc } f10(void) { while (1) {} }
70*f4a2713aSLionel Sambuc 
71*f4a2713aSLionel Sambuc // Small vectors and 1 x {i64,double} are returned in registers
72*f4a2713aSLionel Sambuc 
73*f4a2713aSLionel Sambuc // CHECK: i32 @f11()
74*f4a2713aSLionel Sambuc // CHECK: void @f12(<2 x i32>* noalias sret %agg.result)
75*f4a2713aSLionel Sambuc // CHECK: i64 @f13()
76*f4a2713aSLionel Sambuc // CHECK: i64 @f14()
77*f4a2713aSLionel Sambuc // CHECK: <2 x i64> @f15()
78*f4a2713aSLionel Sambuc // CHECK: <2 x i64> @f16()
79*f4a2713aSLionel Sambuc typedef short T11 __attribute__ ((vector_size (4)));
f11(void)80*f4a2713aSLionel Sambuc T11 f11(void) { while (1) {} }
81*f4a2713aSLionel Sambuc typedef int T12 __attribute__ ((vector_size (8)));
f12(void)82*f4a2713aSLionel Sambuc T12 f12(void) { while (1) {} }
83*f4a2713aSLionel Sambuc typedef long long T13 __attribute__ ((vector_size (8)));
f13(void)84*f4a2713aSLionel Sambuc T13 f13(void) { while (1) {} }
85*f4a2713aSLionel Sambuc typedef double T14 __attribute__ ((vector_size (8)));
f14(void)86*f4a2713aSLionel Sambuc T14 f14(void) { while (1) {} }
87*f4a2713aSLionel Sambuc typedef long long T15 __attribute__ ((vector_size (16)));
f15(void)88*f4a2713aSLionel Sambuc T15 f15(void) { while (1) {} }
89*f4a2713aSLionel Sambuc typedef double T16 __attribute__ ((vector_size (16)));
f16(void)90*f4a2713aSLionel Sambuc T16 f16(void) { while (1) {} }
91*f4a2713aSLionel Sambuc 
92*f4a2713aSLionel Sambuc // And when the single element in a struct (but not for 64 and
93*f4a2713aSLionel Sambuc // 128-bits).
94*f4a2713aSLionel Sambuc 
95*f4a2713aSLionel Sambuc // CHECK: i32 @f17()
96*f4a2713aSLionel Sambuc // CHECK: void @f18(%{{.*}}* noalias sret %agg.result)
97*f4a2713aSLionel Sambuc // CHECK: void @f19(%{{.*}}* noalias sret %agg.result)
98*f4a2713aSLionel Sambuc // CHECK: void @f20(%{{.*}}* noalias sret %agg.result)
99*f4a2713aSLionel Sambuc // CHECK: void @f21(%{{.*}}* noalias sret %agg.result)
100*f4a2713aSLionel Sambuc // CHECK: void @f22(%{{.*}}* noalias sret %agg.result)
f17(void)101*f4a2713aSLionel Sambuc struct { T11 a; } f17(void) { while (1) {} }
f18(void)102*f4a2713aSLionel Sambuc struct { T12 a; } f18(void) { while (1) {} }
f19(void)103*f4a2713aSLionel Sambuc struct { T13 a; } f19(void) { while (1) {} }
f20(void)104*f4a2713aSLionel Sambuc struct { T14 a; } f20(void) { while (1) {} }
f21(void)105*f4a2713aSLionel Sambuc struct { T15 a; } f21(void) { while (1) {} }
f22(void)106*f4a2713aSLionel Sambuc struct { T16 a; } f22(void) { while (1) {} }
107*f4a2713aSLionel Sambuc 
108*f4a2713aSLionel Sambuc // Single element structures are handled specially
109*f4a2713aSLionel Sambuc 
110*f4a2713aSLionel Sambuc // CHECK: float @f23()
111*f4a2713aSLionel Sambuc // CHECK: float @f24()
112*f4a2713aSLionel Sambuc // CHECK: float @f25()
f23(void)113*f4a2713aSLionel Sambuc struct { float a; } f23(void) { while (1) {} }
f24(void)114*f4a2713aSLionel Sambuc struct { float a[1]; } f24(void) { while (1) {} }
f25(void)115*f4a2713aSLionel Sambuc struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} }
116*f4a2713aSLionel Sambuc 
117*f4a2713aSLionel Sambuc // Small structures are handled recursively
118*f4a2713aSLionel Sambuc // CHECK: i32 @f26()
119*f4a2713aSLionel Sambuc // CHECK: void @f27(%struct.s27* noalias sret %agg.result)
f26(void)120*f4a2713aSLionel Sambuc struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} }
f27(void)121*f4a2713aSLionel Sambuc struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} }
122*f4a2713aSLionel Sambuc 
123*f4a2713aSLionel Sambuc // CHECK: void @f28(%struct.s28* noalias sret %agg.result)
f28(void)124*f4a2713aSLionel Sambuc struct s28 { int a; int b[]; } f28(void) { while (1) {} }
125*f4a2713aSLionel Sambuc 
126*f4a2713aSLionel Sambuc // CHECK-LABEL: define i16 @f29()
f29(void)127*f4a2713aSLionel Sambuc struct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} }
128*f4a2713aSLionel Sambuc 
129*f4a2713aSLionel Sambuc // CHECK-LABEL: define i16 @f30()
f30(void)130*f4a2713aSLionel Sambuc struct s30 { char a; char b : 4; } f30(void) { while (1) {} }
131*f4a2713aSLionel Sambuc 
132*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f31()
f31(void)133*f4a2713aSLionel Sambuc struct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} }
134*f4a2713aSLionel Sambuc 
135*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f32()
f32(void)136*f4a2713aSLionel Sambuc struct s32 { char a; unsigned : 0; } f32(void) { while (1) {} }
137*f4a2713aSLionel Sambuc 
138*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f33()
f33(void)139*f4a2713aSLionel Sambuc struct s33 { float a; long long : 0; } f33(void) { while (1) {} }
140*f4a2713aSLionel Sambuc 
141*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f34()
f34(void)142*f4a2713aSLionel Sambuc struct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} }
143*f4a2713aSLionel Sambuc 
144*f4a2713aSLionel Sambuc // CHECK-LABEL: define i16 @f35()
f35(void)145*f4a2713aSLionel Sambuc struct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} }
146*f4a2713aSLionel Sambuc 
147*f4a2713aSLionel Sambuc // CHECK-LABEL: define i16 @f36()
f36(void)148*f4a2713aSLionel Sambuc struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} }
149*f4a2713aSLionel Sambuc 
150*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f37()
f37(void)151*f4a2713aSLionel Sambuc struct s37 { float c[1][1]; } f37(void) { while (1) {} }
152*f4a2713aSLionel Sambuc 
153*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f38(%struct.s38* noalias sret %agg.result)
f38(void)154*f4a2713aSLionel Sambuc struct s38 { char a[3]; short b; } f38(void) { while (1) {} }
155*f4a2713aSLionel Sambuc 
156*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f39(%struct.s39* byval align 16 %x)
157*f4a2713aSLionel Sambuc typedef int v39 __attribute((vector_size(16)));
158*f4a2713aSLionel Sambuc struct s39 { v39 x; };
f39(struct s39 x)159*f4a2713aSLionel Sambuc void f39(struct s39 x) {}
160*f4a2713aSLionel Sambuc 
161*f4a2713aSLionel Sambuc // <rdar://problem/7247671>
162*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f40()
163*f4a2713aSLionel Sambuc enum e40 { ec0 = 0 };
f40(void)164*f4a2713aSLionel Sambuc enum e40 f40(void) { }
165*f4a2713aSLionel Sambuc 
166*f4a2713aSLionel Sambuc // CHECK-LABEL: define void ()* @f41()
167*f4a2713aSLionel Sambuc typedef void (^vvbp)(void);
f41(void)168*f4a2713aSLionel Sambuc vvbp f41(void) { }
169*f4a2713aSLionel Sambuc 
170*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f42()
f42(void)171*f4a2713aSLionel Sambuc struct s42 { enum e40 f0; } f42(void) {  }
172*f4a2713aSLionel Sambuc 
173*f4a2713aSLionel Sambuc // CHECK-LABEL: define i64 @f43()
f43(void)174*f4a2713aSLionel Sambuc struct s43 { enum e40 f0; int f1; } f43(void) {  }
175*f4a2713aSLionel Sambuc 
176*f4a2713aSLionel Sambuc // CHECK-LABEL: define void ()* @f44()
f44(void)177*f4a2713aSLionel Sambuc struct s44 { vvbp f0; } f44(void) {  }
178*f4a2713aSLionel Sambuc 
179*f4a2713aSLionel Sambuc // CHECK-LABEL: define i64 @f45()
f45(void)180*f4a2713aSLionel Sambuc struct s45 { vvbp f0; int f1; } f45(void) {  }
181*f4a2713aSLionel Sambuc 
182*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f46(i32 %a0)
f46(enum e40 a0)183*f4a2713aSLionel Sambuc void f46(enum e40 a0) { }
184*f4a2713aSLionel Sambuc 
185*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f47(void ()* %a1)
f47(vvbp a1)186*f4a2713aSLionel Sambuc void f47(vvbp a1) { }
187*f4a2713aSLionel Sambuc 
188*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f48(i32 %a0.0)
189*f4a2713aSLionel Sambuc struct s48 { enum e40 f0; };
f48(struct s48 a0)190*f4a2713aSLionel Sambuc void f48(struct s48 a0) { }
191*f4a2713aSLionel Sambuc 
192*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f49(i32 %a0.0, i32 %a0.1)
193*f4a2713aSLionel Sambuc struct s49 { enum e40 f0; int f1; };
f49(struct s49 a0)194*f4a2713aSLionel Sambuc void f49(struct s49 a0) { }
195*f4a2713aSLionel Sambuc 
196*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f50(void ()* %a0.0)
197*f4a2713aSLionel Sambuc struct s50 { vvbp f0; };
f50(struct s50 a0)198*f4a2713aSLionel Sambuc void f50(struct s50 a0) { }
199*f4a2713aSLionel Sambuc 
200*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f51(void ()* %a0.0, i32 %a0.1)
201*f4a2713aSLionel Sambuc struct s51 { vvbp f0; int f1; };
f51(struct s51 a0)202*f4a2713aSLionel Sambuc void f51(struct s51 a0) { }
203*f4a2713aSLionel Sambuc 
204*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f52(%struct.s52* byval align 4)
205*f4a2713aSLionel Sambuc struct s52 {
206*f4a2713aSLionel Sambuc   long double a;
207*f4a2713aSLionel Sambuc };
f52(struct s52 x)208*f4a2713aSLionel Sambuc void f52(struct s52 x) {}
209*f4a2713aSLionel Sambuc 
210*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f53(%struct.s53* byval align 4)
211*f4a2713aSLionel Sambuc struct __attribute__((aligned(32))) s53 {
212*f4a2713aSLionel Sambuc   int x;
213*f4a2713aSLionel Sambuc   int y;
214*f4a2713aSLionel Sambuc };
f53(struct s53 x)215*f4a2713aSLionel Sambuc void f53(struct s53 x) {}
216*f4a2713aSLionel Sambuc 
217*f4a2713aSLionel Sambuc typedef unsigned short v2i16 __attribute__((__vector_size__(4)));
218*f4a2713aSLionel Sambuc 
219*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f54(i32 %arg.coerce)
220*f4a2713aSLionel Sambuc // rdar://8359483
f54(v2i16 arg)221*f4a2713aSLionel Sambuc v2i16 f54(v2i16 arg) { return arg+arg; }
222*f4a2713aSLionel Sambuc 
223*f4a2713aSLionel Sambuc 
224*f4a2713aSLionel Sambuc typedef int v4i32 __attribute__((__vector_size__(16)));
225*f4a2713aSLionel Sambuc 
226*f4a2713aSLionel Sambuc // CHECK-LABEL: define <2 x i64> @f55(<4 x i32> %arg)
227*f4a2713aSLionel Sambuc // PR8029
f55(v4i32 arg)228*f4a2713aSLionel Sambuc v4i32 f55(v4i32 arg) { return arg+arg; }
229*f4a2713aSLionel Sambuc 
230*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f56(
231*f4a2713aSLionel Sambuc // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
232*f4a2713aSLionel Sambuc // CHECK: i64 %a2.coerce, %struct.s56_1* byval align 4,
233*f4a2713aSLionel Sambuc // CHECK: i64 %a4.coerce, %struct.s56_2* byval align 4,
234*f4a2713aSLionel Sambuc // CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7,
235*f4a2713aSLionel Sambuc // CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
236*f4a2713aSLionel Sambuc // CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
237*f4a2713aSLionel Sambuc // CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
238*f4a2713aSLionel Sambuc 
239*f4a2713aSLionel Sambuc // CHECK:   call void (i32, ...)* @f56_0(i32 1,
240*f4a2713aSLionel Sambuc // CHECK: i32 %{{[^ ]*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
241*f4a2713aSLionel Sambuc // CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
242*f4a2713aSLionel Sambuc // CHECK: i64 %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
243*f4a2713aSLionel Sambuc // CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 16 %{{[^ ]*}},
244*f4a2713aSLionel Sambuc // CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}},
245*f4a2713aSLionel Sambuc // CHECK: <8 x i32> {{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
246*f4a2713aSLionel Sambuc // CHECK: <4 x double> {{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
247*f4a2713aSLionel Sambuc // CHECK: }
248*f4a2713aSLionel Sambuc //
249*f4a2713aSLionel Sambuc // <rdar://problem/7964854> [i386] clang misaligns long double in structures
250*f4a2713aSLionel Sambuc // when passed byval
251*f4a2713aSLionel Sambuc // <rdar://problem/8431367> clang misaligns parameters on stack
252*f4a2713aSLionel Sambuc typedef int __attribute__((vector_size (8))) t56_v2i;
253*f4a2713aSLionel Sambuc typedef double __attribute__((vector_size (8))) t56_v1d;
254*f4a2713aSLionel Sambuc typedef int __attribute__((vector_size (16))) t56_v4i;
255*f4a2713aSLionel Sambuc typedef double __attribute__((vector_size (16))) t56_v2d;
256*f4a2713aSLionel Sambuc typedef int __attribute__((vector_size (32))) t56_v8i;
257*f4a2713aSLionel Sambuc typedef double __attribute__((vector_size (32))) t56_v4d;
258*f4a2713aSLionel Sambuc 
259*f4a2713aSLionel Sambuc struct s56_0 { char a; };
260*f4a2713aSLionel Sambuc struct s56_1 { t56_v2i a; };
261*f4a2713aSLionel Sambuc struct s56_2 { t56_v1d a; };
262*f4a2713aSLionel Sambuc struct s56_3 { t56_v4i a; };
263*f4a2713aSLionel Sambuc struct s56_4 { t56_v2d a; };
264*f4a2713aSLionel Sambuc struct s56_5 { t56_v8i a; };
265*f4a2713aSLionel Sambuc struct s56_6 { t56_v4d a; };
266*f4a2713aSLionel Sambuc 
f56(char a0,struct s56_0 a1,t56_v2i a2,struct s56_1 a3,t56_v1d a4,struct s56_2 a5,t56_v4i a6,struct s56_3 a7,t56_v2d a8,struct s56_4 a9,t56_v8i a10,struct s56_5 a11,t56_v4d a12,struct s56_6 a13)267*f4a2713aSLionel Sambuc void f56(char a0, struct s56_0 a1,
268*f4a2713aSLionel Sambuc          t56_v2i a2, struct s56_1 a3,
269*f4a2713aSLionel Sambuc          t56_v1d a4, struct s56_2 a5,
270*f4a2713aSLionel Sambuc          t56_v4i a6, struct s56_3 a7,
271*f4a2713aSLionel Sambuc          t56_v2d a8, struct s56_4 a9,
272*f4a2713aSLionel Sambuc          t56_v8i a10, struct s56_5 a11,
273*f4a2713aSLionel Sambuc          t56_v4d a12, struct s56_6 a13) {
274*f4a2713aSLionel Sambuc   extern void f56_0(int x, ...);
275*f4a2713aSLionel Sambuc   f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
276*f4a2713aSLionel Sambuc         a10, a11, a12, a13);
277*f4a2713aSLionel Sambuc }
278*f4a2713aSLionel Sambuc 
279*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f57(i32 %x.0, i32 %x.1)
280*f4a2713aSLionel Sambuc // CHECK: call void @f57(
281*f4a2713aSLionel Sambuc struct s57 { _Complex int x; };
f57a(void)282*f4a2713aSLionel Sambuc void f57(struct s57 x) {} void f57a(void) { f57((struct s57){1}); }
283*f4a2713aSLionel Sambuc 
284*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f58()
285*f4a2713aSLionel Sambuc union u58 {};
f58(union u58 x)286*f4a2713aSLionel Sambuc void f58(union u58 x) {}
287*f4a2713aSLionel Sambuc 
288*f4a2713aSLionel Sambuc // CHECK-LABEL: define i64 @f59()
289*f4a2713aSLionel Sambuc struct s59 { float x __attribute((aligned(8))); };
f59()290*f4a2713aSLionel Sambuc struct s59 f59() { while (1) {} }
291*f4a2713aSLionel Sambuc 
292*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f60(%struct.s60* byval align 4, i32 %y)
293*f4a2713aSLionel Sambuc struct s60 { int x __attribute((aligned(8))); };
f60(struct s60 x,int y)294*f4a2713aSLionel Sambuc void f60(struct s60 x, int y) {}
295*f4a2713aSLionel Sambuc 
296*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f61(i32 %x, %struct.s61* byval align 16 %y)
297*f4a2713aSLionel Sambuc typedef int T61 __attribute((vector_size(16)));
298*f4a2713aSLionel Sambuc struct s61 { T61 x; int y; };
f61(int x,struct s61 y)299*f4a2713aSLionel Sambuc void f61(int x, struct s61 y) {}
300*f4a2713aSLionel Sambuc 
301*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f62(i32 %x, %struct.s62* byval align 4)
302*f4a2713aSLionel Sambuc typedef int T62 __attribute((vector_size(16)));
303*f4a2713aSLionel Sambuc struct s62 { T62 x; int y; } __attribute((packed, aligned(8)));
f62(int x,struct s62 y)304*f4a2713aSLionel Sambuc void f62(int x, struct s62 y) {}
305*f4a2713aSLionel Sambuc 
306*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f63
307*f4a2713aSLionel Sambuc // CHECK: ptrtoint
308*f4a2713aSLionel Sambuc // CHECK: and {{.*}}, -16
309*f4a2713aSLionel Sambuc // CHECK: inttoptr
310*f4a2713aSLionel Sambuc typedef int T63 __attribute((vector_size(16)));
311*f4a2713aSLionel Sambuc struct s63 { T63 x; int y; };
f63(int i,...)312*f4a2713aSLionel Sambuc int f63(int i, ...) {
313*f4a2713aSLionel Sambuc   __builtin_va_list ap;
314*f4a2713aSLionel Sambuc   __builtin_va_start(ap, i);
315*f4a2713aSLionel Sambuc   struct s63 s = __builtin_va_arg(ap, struct s63);
316*f4a2713aSLionel Sambuc   __builtin_va_end(ap);
317*f4a2713aSLionel Sambuc   return s.y;
318*f4a2713aSLionel Sambuc }
319*f4a2713aSLionel Sambuc 
320*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f64(%struct.s64* byval align 4 %x)
321*f4a2713aSLionel Sambuc struct s64 { signed char a[0]; signed char b[]; };
f64(struct s64 x)322*f4a2713aSLionel Sambuc void f64(struct s64 x) {}
323*f4a2713aSLionel Sambuc 
324*f4a2713aSLionel Sambuc // CHECK-LABEL: define float @f65()
325*f4a2713aSLionel Sambuc struct s65 { signed char a[0]; float b; };
f65()326*f4a2713aSLionel Sambuc struct s65 f65() { return (struct s65){{},2}; }
327*f4a2713aSLionel Sambuc 
328*f4a2713aSLionel Sambuc // CHECK-LABEL: define <2 x i64> @f66
329*f4a2713aSLionel Sambuc // CHECK: ptrtoint
330*f4a2713aSLionel Sambuc // CHECK: and {{.*}}, -16
331*f4a2713aSLionel Sambuc // CHECK: inttoptr
332*f4a2713aSLionel Sambuc typedef int T66 __attribute((vector_size(16)));
f66(int i,...)333*f4a2713aSLionel Sambuc T66 f66(int i, ...) {
334*f4a2713aSLionel Sambuc   __builtin_va_list ap;
335*f4a2713aSLionel Sambuc   __builtin_va_start(ap, i);
336*f4a2713aSLionel Sambuc   T66 v = __builtin_va_arg(ap, T66);
337*f4a2713aSLionel Sambuc   __builtin_va_end(ap);
338*f4a2713aSLionel Sambuc   return v;
339*f4a2713aSLionel Sambuc }
340*f4a2713aSLionel Sambuc 
341*f4a2713aSLionel Sambuc // PR14453
342*f4a2713aSLionel Sambuc struct s67 { _Complex unsigned short int a; };
f67(struct s67 x)343*f4a2713aSLionel Sambuc void f67(struct s67 x) {}
344*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f67(%struct.s67* byval align 4 %x)
345