xref: /aosp_15_r20/external/clang/test/CodeGenObjC/stret_lookup.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -DSTRET -triple x86_64-pc-linux-gnu -fobjc-runtime=objfw -emit-llvm -o - %s | FileCheck -check-prefix=HASSTRET %s
2*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck -check-prefix=NOSTRET %s
3*67e74705SXin Li
4*67e74705SXin Li// Test stret lookup
5*67e74705SXin Li
6*67e74705SXin Listruct test {
7*67e74705SXin Li  char test[1024];
8*67e74705SXin Li};
9*67e74705SXin Li@interface Test0
10*67e74705SXin Li+ (struct test)test;
11*67e74705SXin Li@end
12*67e74705SXin Livoid test0(void) {
13*67e74705SXin Li  struct test t;
14*67e74705SXin Li#if (defined(STRET) && defined(__OBJFW_RUNTIME_ABI__)) || \
15*67e74705SXin Li    (!defined(STRET) && !defined(__OBJFW_RUNTIME_ABI__))
16*67e74705SXin Li  t = [Test0 test];
17*67e74705SXin Li#endif
18*67e74705SXin Li  (void)t;
19*67e74705SXin Li}
20*67e74705SXin Li
21*67e74705SXin Li// HASSTRET-LABEL: define void @test0()
22*67e74705SXin Li// HASSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* @objc_msg_lookup_stret(i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*),
23*67e74705SXin Li// HASSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)*
24*67e74705SXin Li// HASSTRET-NEXT: call void [[T1]](%struct.test* sret {{.*}}, i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*),
25*67e74705SXin Li
26*67e74705SXin Li// NOSTRET-LABEL: define void @test0()
27*67e74705SXin Li// NOSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* @objc_msg_lookup(i8*
28*67e74705SXin Li// NOSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)*
29*67e74705SXin Li// NOSTRET-NEXT: call void [[T1]](%struct.test* sret {{.*}}, i8* {{.*}}, i8* bitcast ([2 x { i8*, i8* }]*
30