1 // RUN: %clang_cc1 -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 %0)
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] %0)
30 // Pass and return for type size > 16 bytes.
31 // CHECK: define {{.*}} void @{{.*}}f3{{.*}}(ptr noalias sret(%struct.S3) align 4 %agg.result)
32 // CHECK: call void {{.*}}func3{{.*}}(ptr sret(%struct.S3) align 4 %agg.result, ptr 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{{.*}}(ptr inreg noalias sret(%struct.S4) align 4 %agg.result)
46 // CHECK: call void {{.*}}func4{{.*}}(ptr inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %0)
58 // Pass and return from instance method called from instance method.
59 // CHECK: define {{.*}} void @{{.*}}bar@Q1{{.*}}(ptr {{[^,]*}} %this, ptr inreg noalias sret(%class.P1) align 1 %agg.result)
60 // CHECK: call void {{.*}}foo@P1{{.*}}(ptr noundef{{[^,]*}} %ref.tmp, ptr inreg sret(%class.P1) align 1 %agg.result, i8 %0)
77 // Pass and return from instance method called from free function.
78 // CHECK: define {{.*}} void {{.*}}bar{{.*}}()
79 // CHECK: call void {{.*}}foo@P2{{.*}}(ptr noundef{{[^,]*}} %ref.tmp, ptr 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{{.*}}(ptr inreg noalias sret(%struct.S5) align 4 %agg.result)
93 // CHECK: call void {{.*}}func5{{.*}}(ptr 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{{.*}}(ptr inreg noalias sret(%struct.S8) align 4 {{.*}})
150 // CHECK: call void {{.*}}func8{{.*}}(ptr 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"(ptr inreg noalias sret(%struct.S9) align 4 {{.*}})
161 // CHECK: call void {{.*}}func9{{.*}}(ptr 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{{.*}}(ptr inreg noalias sret(%struct.S10) align 4 {{.*}})
178 // CHECK: call void {{.*}}func10{{.*}}(ptr 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{{.*}}(ptr inreg noalias sret(%struct.S11) align 8 {{.*}})
193 // CHECK: call void {{.*}}func11{{.*}}(ptr inreg sret(%struct.S11) align 8 {{.*}}, ptr {{.*}})