1 // RUN: %clang_cc1 -no-opaque-pointers -triple aarch64-windows -ffreestanding -emit-llvm -O0 \
2 // RUN: -x c++ -o - %s | FileCheck %s
4 // Pass and return for type size <= 8 bytes.
5 // CHECK: define {{.*}} i64 @{{.*}}f1{{.*}}()
6 // CHECK: call i64 {{.*}}func1{{.*}}(i64 %3)
17 // Pass and return type size <= 16 bytes.
18 // CHECK: define {{.*}} [2 x i64] @{{.*}}f2{{.*}}()
19 // CHECK: call [2 x i64] {{.*}}func2{{.*}}([2 x i64] %3)
30 // Pass and return for type size > 16 bytes.
31 // CHECK: define {{.*}} void @{{.*}}f3{{.*}}(%struct.S3* noalias sret(%struct.S3) align 4 %agg.result)
32 // CHECK: call void {{.*}}func3{{.*}}(%struct.S3* sret(%struct.S3) align 4 %agg.result, %struct.S3* noundef %agg.tmp)
43 // Pass and return aggregate (of size < 16 bytes) with non-trivial destructor.
44 // Passed directly but returned indirectly.
45 // CHECK: define {{.*}} void {{.*}}f4{{.*}}(%struct.S4* inreg noalias sret(%struct.S4) align 4 %agg.result)
46 // CHECK: call void {{.*}}func4{{.*}}(%struct.S4* inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %5)
58 // Pass and return from instance method called from instance method.
59 // CHECK: define {{.*}} void @{{.*}}bar@Q1{{.*}}(%class.Q1* {{[^,]*}} %this, %class.P1* inreg noalias sret(%class.P1) align 1 %agg.result)
60 // CHECK: call void {{.*}}foo@P1{{.*}}(%class.P1* noundef{{[^,]*}} %ref.tmp, %class.P1* inreg sret(%class.P1) align 1 %agg.result, i8 %1)
77 // Pass and return from instance method called from free function.
78 // CHECK: define {{.*}} void {{.*}}bar{{.*}}()
79 // CHECK: call void {{.*}}foo@P2{{.*}}(%class.P2* noundef{{[^,]*}} %ref.tmp, %class.P2* inreg sret(%class.P2) align 1 %retval, i8 %0)
90 // Pass and return an object with a user-provided constructor (passed directly,
91 // returned indirectly)
92 // CHECK: define {{.*}} void @{{.*}}f5{{.*}}(%struct.S5* inreg noalias sret(%struct.S5) align 4 %agg.result)
93 // CHECK: call void {{.*}}func5{{.*}}(%struct.S5* inreg sret(%struct.S5) align 4 %agg.result, i64 {{.*}})
105 // Pass and return an object with a non-trivial explicitly defaulted constructor
106 // (passed directly, returned directly)
107 // CHECK: define {{.*}} i8 @"?f6@@YA?AUS6@@XZ"()
108 // CHECK: call i8 {{.*}}func6{{.*}}(i64 {{.*}})
124 // Pass and return an object with a non-trivial implicitly defaulted constructor
125 // (passed directly, returned directly)
126 // CHECK: define {{.*}} i8 @"?f7@@YA?AUS7@@XZ"()
127 // CHECK: call i8 {{.*}}func7{{.*}}(i64 {{.*}})
142 // Pass and return an object with a non-trivial default destructor (passed
143 // directly, returne indirectly)
149 // CHECK: define {{.*}} void {{.*}}?f8{{.*}}(%struct.S8* inreg noalias sret(%struct.S8) align 4 {{.*}})
150 // CHECK: call void {{.*}}func8{{.*}}(%struct.S8* inreg sret(%struct.S8) align 4 {{.*}}, i64 {{.*}})
158 // Pass and return an object with a non-trivial copy-assignment operator and
159 // a trivial copy constructor (passed directly, returned indirectly)
160 // CHECK: define {{.*}} void @"?f9@@YA?AUS9@@XZ"(%struct.S9* inreg noalias sret(%struct.S9) align 4 {{.*}})
161 // CHECK: call void {{.*}}func9{{.*}}(%struct.S9* inreg sret(%struct.S9) align 4 {{.*}}, i64 {{.*}})
163 S9
& operator=(const S9
&);
175 // Pass and return an object with a base class (passed directly, returned
177 // CHECK: define dso_local void {{.*}}f10{{.*}}(%struct.S10* inreg noalias sret(%struct.S10) align 4 {{.*}})
178 // CHECK: call void {{.*}}func10{{.*}}(%struct.S10* inreg sret(%struct.S10) align 4 {{.*}}, [2 x i64] {{.*}})
179 struct S10
: public S1
{
190 // Pass and return a non aggregate object exceeding > 128 bits (passed
191 // indirectly, returned indirectly)
192 // CHECK: define dso_local void {{.*}}f11{{.*}}(%struct.S11* inreg noalias sret(%struct.S11) align 8 {{.*}})
193 // CHECK: call void {{.*}}func11{{.*}}(%struct.S11* inreg sret(%struct.S11) align 8 {{.*}}, %struct.S11* {{.*}})