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