Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -w -fblocks -triple i386-pc-linux-gnu -target-cpu pentium4 -emit-llvm -o %t %s
      2 // RUN: FileCheck < %t %s
      3 
      4 // CHECK: define void @f56(
      5 // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
      6 // CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
      7 // CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
      8 // CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
      9 // CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
     10 // CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
     11 // CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
     12 
     13 // CHECK: call void (i32, ...)* @f56_0(i32 1,
     14 // CHECK: i32 %{{.*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
     15 // CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
     16 // CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
     17 // CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 4 %{{[^ ]*}},
     18 // CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 4 %{{[^ ]*}},
     19 // CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
     20 // CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
     21 // CHECK: }
     22 //
     23 // <rdar://problem/7964854> [i386] clang misaligns long double in structures
     24 // when passed byval
     25 // <rdar://problem/8431367> clang misaligns parameters on stack
     26 typedef int __attribute__((vector_size (8))) t56_v2i;
     27 typedef double __attribute__((vector_size (8))) t56_v1d;
     28 typedef int __attribute__((vector_size (16))) t56_v4i;
     29 typedef double __attribute__((vector_size (16))) t56_v2d;
     30 typedef int __attribute__((vector_size (32))) t56_v8i;
     31 typedef double __attribute__((vector_size (32))) t56_v4d;
     32 
     33 struct s56_0 { char a; };
     34 struct s56_1 { t56_v2i a; };
     35 struct s56_2 { t56_v1d a; };
     36 struct s56_3 { t56_v4i a; };
     37 struct s56_4 { t56_v2d a; };
     38 struct s56_5 { t56_v8i a; };
     39 struct s56_6 { t56_v4d a; };
     40 
     41 void f56(char a0, struct s56_0 a1,
     42          t56_v2i a2, struct s56_1 a3,
     43          t56_v1d a4, struct s56_2 a5,
     44          t56_v4i a6, struct s56_3 a7,
     45          t56_v2d a8, struct s56_4 a9,
     46          t56_v8i a10, struct s56_5 a11,
     47          t56_v4d a12, struct s56_6 a13) {
     48   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