1 ; FIXME: Add tests for global-isel/fast-isel.
3 ; RUN: llc < %s -mtriple=arm64-windows | FileCheck %s
5 ; Returns <= 8 bytes should be in X0.
6 %struct.S1 = type { i32, i32 }
7 define dso_local i64 @"?f1"() {
10 ; CHECK: str xzr, [sp, #8]
13 %retval = alloca %struct.S1, align 4
14 %a = getelementptr inbounds %struct.S1, %struct.S1* %retval, i32 0, i32 0
15 store i32 0, i32* %a, align 4
16 %b = getelementptr inbounds %struct.S1, %struct.S1* %retval, i32 0, i32 1
17 store i32 0, i32* %b, align 4
18 %0 = bitcast %struct.S1* %retval to i64*
19 %1 = load i64, i64* %0, align 4
23 ; Returns <= 16 bytes should be in X0/X1.
24 %struct.S2 = type { i32, i32, i32, i32 }
25 define dso_local [2 x i64] @"?f2"() {
28 ; CHECK: stp xzr, xzr, [sp], #16
32 %retval = alloca %struct.S2, align 4
33 %a = getelementptr inbounds %struct.S2, %struct.S2* %retval, i32 0, i32 0
34 store i32 0, i32* %a, align 4
35 %b = getelementptr inbounds %struct.S2, %struct.S2* %retval, i32 0, i32 1
36 store i32 0, i32* %b, align 4
37 %c = getelementptr inbounds %struct.S2, %struct.S2* %retval, i32 0, i32 2
38 store i32 0, i32* %c, align 4
39 %d = getelementptr inbounds %struct.S2, %struct.S2* %retval, i32 0, i32 3
40 store i32 0, i32* %d, align 4
41 %0 = bitcast %struct.S2* %retval to [2 x i64]*
42 %1 = load [2 x i64], [2 x i64]* %0, align 4
46 ; Arguments > 16 bytes should be passed in X8.
47 %struct.S3 = type { i32, i32, i32, i32, i32 }
48 define dso_local void @"?f3"(%struct.S3* noalias sret %agg.result) {
51 ; CHECK: stp xzr, xzr, [x8]
52 ; CHECK: str wzr, [x8, #16]
54 %a = getelementptr inbounds %struct.S3, %struct.S3* %agg.result, i32 0, i32 0
55 store i32 0, i32* %a, align 4
56 %b = getelementptr inbounds %struct.S3, %struct.S3* %agg.result, i32 0, i32 1
57 store i32 0, i32* %b, align 4
58 %c = getelementptr inbounds %struct.S3, %struct.S3* %agg.result, i32 0, i32 2
59 store i32 0, i32* %c, align 4
60 %d = getelementptr inbounds %struct.S3, %struct.S3* %agg.result, i32 0, i32 3
61 store i32 0, i32* %d, align 4
62 %e = getelementptr inbounds %struct.S3, %struct.S3* %agg.result, i32 0, i32 4
63 store i32 0, i32* %e, align 4
67 ; InReg arguments to non-instance methods must be passed in X0 and returns in
69 %class.B = type { i32 }
70 define dso_local void @"?f4"(%class.B* inreg noalias nocapture sret %agg.result) {
75 %X.i = getelementptr inbounds %class.B, %class.B* %agg.result, i64 0, i32 0
76 store i32 1, i32* %X.i, align 4
80 ; InReg arguments to instance methods must be passed in X1 and returns in X0.
81 %class.C = type { i8 }
82 %class.A = type { i8 }
84 define dso_local void @"?inst@C"(%class.C* %this, %class.A* inreg noalias sret %agg.result) {
87 ; CHECK: str x0, [sp, #8]
90 %this.addr = alloca %class.C*, align 8
91 store %class.C* %this, %class.C** %this.addr, align 8
92 %this1 = load %class.C*, %class.C** %this.addr, align 8