xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/arc-arm.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc// <rdar://12438598>: use an autorelease marker on ARM64.
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambucid test0(void) {
7f4a2713aSLionel Sambuc  extern id test0_helper(void);
8*0a6a1f1dSLionel Sambuc  // CHECK:      [[T0:%.*]] = call [[CC:(arm_aapcscc )?]]i8* @test0_helper()
9f4a2713aSLionel Sambuc  // CHECK-NEXT: ret i8* [[T0]]
10f4a2713aSLionel Sambuc  return test0_helper();
11f4a2713aSLionel Sambuc}
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambucvoid test1(void) {
14f4a2713aSLionel Sambuc  extern id test1_helper(void);
15*0a6a1f1dSLionel Sambuc  // CHECK:      [[T0:%.*]] = call [[CC]]i8* @test1_helper()
16*0a6a1f1dSLionel Sambuc  // CHECK-NEXT: call void asm sideeffect "mov
17*0a6a1f1dSLionel Sambuc  // CHECK-NEXT: [[T1:%.*]] = call [[CC]]i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
18f4a2713aSLionel Sambuc  // CHECK-NEXT: store i8* [[T1]],
19*0a6a1f1dSLionel Sambuc  // CHECK-NEXT: call [[CC]]void @objc_storeStrong(
20f4a2713aSLionel Sambuc  // CHECK-NEXT: ret void
21f4a2713aSLionel Sambuc  id x = test1_helper();
22f4a2713aSLionel Sambuc}
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc// rdar://problem/12133032
25f4a2713aSLionel Sambuc@class A;
26f4a2713aSLionel SambucA *test2(void) {
27f4a2713aSLionel Sambuc  extern A *test2_helper(void);
28*0a6a1f1dSLionel Sambuc  // CHECK:      [[T0:%.*]] = call [[CC]][[A:%.*]]* @test2_helper()
29f4a2713aSLionel Sambuc  // CHECK-NEXT: ret [[A]]* [[T0]]
30f4a2713aSLionel Sambuc  return test2_helper();
31f4a2713aSLionel Sambuc}
32f4a2713aSLionel Sambuc
33f4a2713aSLionel Sambucid test3(void) {
34f4a2713aSLionel Sambuc  extern A *test3_helper(void);
35*0a6a1f1dSLionel Sambuc  // CHECK:      [[T0:%.*]] = call [[CC]][[A:%.*]]* @test3_helper()
36f4a2713aSLionel Sambuc  // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
37f4a2713aSLionel Sambuc  // CHECK-NEXT: ret i8* [[T1]]
38f4a2713aSLionel Sambuc  return test3_helper();
39f4a2713aSLionel Sambuc}
40