1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc-unknown-aix -target-feature +altivec \
3 // RUN:   -emit-llvm -o - %s | FileCheck --check-prefix=AIX32 %s
4 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-feature +altivec \
5 // RUN:   -emit-llvm -o - %s | FileCheck --check-prefix=AIX64 %s
6 
7 typedef struct {
8 } Zero;
9 typedef struct {
10   char c;
11 } One;
12 typedef struct {
13   short s;
14 } Two;
15 typedef struct {
16   char c[3];
17 } Three;
18 typedef struct {
19   float f;
20 } Four;
21 typedef struct {
22   char c[5];
23 } Five;
24 typedef struct {
25   short s[3];
26 } Six;
27 typedef struct {
28   char c[7];
29 } Seven;
30 typedef struct {
31   long long l;
32 } Eight;
33 typedef struct {
34   int i;
35 } __attribute__((aligned(32))) OverAligned;
36 typedef struct {
37   int i;
38   vector signed int vsi;
39 } StructVector;
40 
41 // AIX32-LABEL: define void @arg0(%struct.Zero* byval(%struct.Zero) align 4 %x)
42 // AIX64-LABEL: define void @arg0(%struct.Zero* byval(%struct.Zero) align 8 %x)
arg0(Zero x)43 void arg0(Zero x) {}
44 
45 // AIX32-LABEL: define void @arg1(%struct.One* byval(%struct.One) align 4 %x)
46 // AIX64-LABEL: define void @arg1(%struct.One* byval(%struct.One) align 8 %x)
arg1(One x)47 void arg1(One x) {}
48 
49 // AIX32-LABEL: define void @arg2(%struct.Two* byval(%struct.Two) align 4 %x)
50 // AIX64-LABEL: define void @arg2(%struct.Two* byval(%struct.Two) align 8 %x)
arg2(Two x)51 void arg2(Two x) {}
52 
53 // AIX32-LABEL: define void @arg3(%struct.Three* byval(%struct.Three) align 4 %x)
54 // AIX64-LABEL: define void @arg3(%struct.Three* byval(%struct.Three) align 8 %x)
arg3(Three x)55 void arg3(Three x) {}
56 
57 // AIX32-LABEL: define void @arg4(%struct.Four* byval(%struct.Four) align 4 %x)
58 // AIX64-LABEL: define void @arg4(%struct.Four* byval(%struct.Four) align 8 %x)
arg4(Four x)59 void arg4(Four x) {}
60 
61 // AIX32-LABEL: define void @arg5(%struct.Five* byval(%struct.Five) align 4 %x)
62 // AIX64-LABEL: define void @arg5(%struct.Five* byval(%struct.Five) align 8 %x)
arg5(Five x)63 void arg5(Five x) {}
64 
65 // AIX32-LABEL: define void @arg6(%struct.Six* byval(%struct.Six) align 4 %x)
66 // AIX64-LABEL: define void @arg6(%struct.Six* byval(%struct.Six) align 8 %x)
arg6(Six x)67 void arg6(Six x) {}
68 
69 // AIX32-LABEL: define void @arg7(%struct.Seven* byval(%struct.Seven) align 4 %x)
70 // AIX64-LABEL: define void @arg7(%struct.Seven* byval(%struct.Seven) align 8 %x)
arg7(Seven x)71 void arg7(Seven x) {}
72 
73 // AIX32-LABEL: define void @arg8(%struct.Eight* byval(%struct.Eight) align 4 %0)
74 // AIX32:         %x = alloca %struct.Eight, align 8
75 // AIX32:         call void @llvm.memcpy.p0i8.p0i8.i32
76 // AIX64-LABEL: define void @arg8(%struct.Eight* byval(%struct.Eight) align 8 %x)
arg8(Eight x)77 void arg8(Eight x) {}
78 
79 // AIX32-LABEL: define void @arg9(%struct.OverAligned* byval(%struct.OverAligned) align 4 %0)
80 // AIX32:         %x = alloca %struct.OverAligned, align 32
81 // AIX32:         call void @llvm.memcpy.p0i8.p0i8.i32
82 // AIX64-LABEL: define void @arg9(%struct.OverAligned* byval(%struct.OverAligned) align 8 %0)
83 // AIX64:         %x = alloca %struct.OverAligned, align 32
84 // AIX64:         call void @llvm.memcpy.p0i8.p0i8.i64
arg9(OverAligned x)85 void arg9(OverAligned x) {}
86 
87 // AIX32-LABEL: define void @arg10(%struct.StructVector* byval(%struct.StructVector) align 16 %x)
88 // AIX64-LABEL: define void @arg10(%struct.StructVector* byval(%struct.StructVector) align 16 %x)
arg10(StructVector x)89 void arg10(StructVector x) {}
90