xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/2011-01-22-SRet.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker;RUN: llc -march=sparc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker%struct.foo_t = type { i32, i32, i32 }
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine weak void @make_foo(%struct.foo_t* noalias sret %agg.result, i32 %a, i32 %b, i32 %c) nounwind {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: make_foo:
8*9880d681SAndroid Build Coastguard Worker;CHECK: ld [%sp+64], {{.+}}
9*9880d681SAndroid Build Coastguard Worker;CHECK: jmp %o7+12
10*9880d681SAndroid Build Coastguard Worker  %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 0
11*9880d681SAndroid Build Coastguard Worker  store i32 %a, i32* %0, align 4
12*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 1
13*9880d681SAndroid Build Coastguard Worker  store i32 %b, i32* %1, align 4
14*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 2
15*9880d681SAndroid Build Coastguard Worker  store i32 %c, i32* %2, align 4
16*9880d681SAndroid Build Coastguard Worker  ret void
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine i32 @test() nounwind {
20*9880d681SAndroid Build Coastguard Workerentry:
21*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: test:
22*9880d681SAndroid Build Coastguard Worker;CHECK: call make_foo
23*9880d681SAndroid Build Coastguard Worker;CHECK: st {{.+}}, [%sp+64]
24*9880d681SAndroid Build Coastguard Worker;CHECK: unimp 12
25*9880d681SAndroid Build Coastguard Worker  %f = alloca %struct.foo_t, align 8
26*9880d681SAndroid Build Coastguard Worker  call void @make_foo(%struct.foo_t* noalias sret %f, i32 10, i32 20, i32 30) nounwind
27*9880d681SAndroid Build Coastguard Worker  %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 0
28*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32* %0, align 8
29*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 1
30*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %2, align 4
31*9880d681SAndroid Build Coastguard Worker  %4 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 2
32*9880d681SAndroid Build Coastguard Worker  %5 = load i32, i32* %4, align 8
33*9880d681SAndroid Build Coastguard Worker  %6 = add nsw i32 %3, %1
34*9880d681SAndroid Build Coastguard Worker  %7 = add nsw i32 %6, %5
35*9880d681SAndroid Build Coastguard Worker  ret i32 %7
36*9880d681SAndroid Build Coastguard Worker}
37