Skip to content

Commit 333dbf5

Browse files
hmelderdavidchisnall
authored andcommitted
Add ObjCXX unit test for stret on WoA64
1 parent c9db483 commit 333dbf5

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fobjc-runtime=gnustep-2.2 -fobjc-dispatch-method=non-legacy -emit-llvm -o - %s | FileCheck %s
2+
3+
// Pass and return for type size <= 8 bytes.
4+
struct S1 {
5+
int a[2];
6+
};
7+
8+
// Pass and return hfa <= 8 bytes
9+
struct F1 {
10+
float a[2];
11+
};
12+
13+
// Pass and return for type size > 16 bytes.
14+
struct S2 {
15+
int a[5];
16+
};
17+
18+
// Pass and return aggregate (of size < 16 bytes) with non-trivial destructor.
19+
// Sret and inreg: Returned in x0
20+
struct S3 {
21+
int a[3];
22+
~S3();
23+
};
24+
S3::~S3() {
25+
}
26+
27+
28+
@interface MsgTest { id isa; } @end
29+
@implementation MsgTest
30+
- (S1) smallS1 {
31+
S1 x;
32+
x.a[0] = 0;
33+
x.a[1] = 1;
34+
return x;
35+
36+
}
37+
- (F1) smallF1 {
38+
F1 x;
39+
x.a[0] = 0.2f;
40+
x.a[1] = 0.5f;
41+
return x;
42+
}
43+
- (S2) stretS2 {
44+
S2 x;
45+
for (int i = 0; i < 5; i++) {
46+
x.a[i] = i;
47+
}
48+
return x;
49+
}
50+
- (S3) stretInRegS3 {
51+
S3 x;
52+
for (int i = 0; i < 3; i++) {
53+
x.a[i] = i;
54+
}
55+
return x;
56+
}
57+
+ (S3) msgTestStretInRegS3 {
58+
S3 x;
59+
for (int i = 0; i < 3; i++) {
60+
x.a[i] = i;
61+
}
62+
return x;
63+
}
64+
@end
65+
66+
void test0(MsgTest *t) {
67+
// CHECK: call {{.*}} @objc_msgSend
68+
S1 ret = [t smallS1];
69+
// CHECK: call {{.*}} @objc_msgSend
70+
F1 ret2 = [t smallF1];
71+
// CHECK: call {{.*}} @objc_msgSend_stret
72+
S2 ret3 = [t stretS2];
73+
// CHECK: call {{.*}} @objc_msgSend_stret2_np
74+
S3 ret4 = [t stretInRegS3];
75+
// CHECK: call {{.*}} @objc_msgSend_stret2_np
76+
S3 ret5 = [MsgTest msgTestStretInRegS3];
77+
}

0 commit comments

Comments
 (0)