1 ;RUN: llc -march=sparc < %s | FileCheck %s
3 %struct.foo_t = type { i32, i32, i32 }
5 define weak void @make_foo(ptr noalias sret(%struct.foo_t) %agg.result, i32 %a, i32 %b, i32 %c) nounwind {
7 ;CHECK-LABEL: make_foo:
8 ;CHECK: ld [%sp+64], {{.+}}
10 %0 = getelementptr inbounds %struct.foo_t, ptr %agg.result, i32 0, i32 0
11 store i32 %a, ptr %0, align 4
12 %1 = getelementptr inbounds %struct.foo_t, ptr %agg.result, i32 0, i32 1
13 store i32 %b, ptr %1, align 4
14 %2 = getelementptr inbounds %struct.foo_t, ptr %agg.result, i32 0, i32 2
15 store i32 %c, ptr %2, align 4
19 define i32 @test() nounwind {
23 ;CHECK: st {{.+}}, [%sp+64]
25 %f = alloca %struct.foo_t, align 8
26 call void @make_foo(ptr noalias sret(%struct.foo_t) %f, i32 10, i32 20, i32 30) nounwind
27 %0 = getelementptr inbounds %struct.foo_t, ptr %f, i32 0, i32 0
28 %1 = load i32, ptr %0, align 8
29 %2 = getelementptr inbounds %struct.foo_t, ptr %f, i32 0, i32 1
30 %3 = load i32, ptr %2, align 4
31 %4 = getelementptr inbounds %struct.foo_t, ptr %f, i32 0, i32 2
32 %5 = load i32, ptr %4, align 8
33 %6 = add nsw i32 %3, %1
34 %7 = add nsw i32 %6, %5