1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -w -fblocks -triple i386-pc-linux-gnu -target-cpu pentium4 -emit-llvm -o %t %s
23e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// RUN: FileCheck < %t %s
33e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith
43e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: define void @f56(
53e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
63e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
73e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
83e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
93e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
103e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
113e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
123e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith
133e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: call void (i32, ...)* @f56_0(i32 1,
14b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor// CHECK: i32 %{{.*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
15b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
16b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor// CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
17b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 4 %{{[^ ]*}},
183e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 4 %{{[^ ]*}},
193e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
203e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
213e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// CHECK: }
223e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith//
233e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// <rdar://problem/7964854> [i386] clang misaligns long double in structures
243e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// when passed byval
253e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith// <rdar://problem/8431367> clang misaligns parameters on stack
263e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef int __attribute__((vector_size (8))) t56_v2i;
273e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef double __attribute__((vector_size (8))) t56_v1d;
283e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef int __attribute__((vector_size (16))) t56_v4i;
293e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef double __attribute__((vector_size (16))) t56_v2d;
303e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef int __attribute__((vector_size (32))) t56_v8i;
313e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithtypedef double __attribute__((vector_size (32))) t56_v4d;
323e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith
333e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_0 { char a; };
343e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_1 { t56_v2i a; };
353e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_2 { t56_v1d a; };
363e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_3 { t56_v4i a; };
373e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_4 { t56_v2d a; };
383e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_5 { t56_v8i a; };
393e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithstruct s56_6 { t56_v4d a; };
403e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith
413e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smithvoid f56(char a0, struct s56_0 a1,
423e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith         t56_v2i a2, struct s56_1 a3,
433e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith         t56_v1d a4, struct s56_2 a5,
443e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith         t56_v4i a6, struct s56_3 a7,
45b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor         t56_v2d a8, struct s56_4 a9,
46b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor         t56_v8i a10, struct s56_5 a11,
47b70126a328f89937f46db42f9e3cba1592887c91Douglas Gregor         t56_v4d a12, struct s56_6 a13) {
483e4c6c4c79a03f5cb0c4671d7c282d623c6dc35eRichard Smith  extern void f56_0(int x, ...);
49  f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
50        a10, a11, a12, a13);
51}
52