blob: 678544ebf2cb47241fe6130ef0af7be6b5d3bfc8 [file] [log] [blame]
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +00001;RUN: llc -march=sparc < %s | FileCheck %s
2
3%struct.foo_t = type { i32, i32, i32 }
4
5define weak void @make_foo(%struct.foo_t* noalias sret %agg.result, i32 %a, i32 %b, i32 %c) nounwind {
6entry:
Stephen Lin6f36b452013-07-18 22:47:09 +00007;CHECK-LABEL: make_foo:
Venkatraman Govindaraju3e8c7d92013-06-02 02:24:27 +00008;CHECK: ld [%sp+64], {{.+}}
9;CHECK: jmp %o7+12
David Blaikie79e6c742015-02-27 19:29:02 +000010 %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 0
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000011 store i32 %a, i32* %0, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000012 %1 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 1
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000013 store i32 %b, i32* %1, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000014 %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 2
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000015 store i32 %c, i32* %2, align 4
16 ret void
17}
18
19define i32 @test() nounwind {
20entry:
Stephen Lin6f36b452013-07-18 22:47:09 +000021;CHECK-LABEL: test:
Stephen Lin98cbca22013-07-18 22:29:15 +000022;CHECK: call make_foo
James Y Knight1f3e6af2015-09-10 21:49:06 +000023;CHECK: st {{.+}}, [%sp+64]
Venkatraman Govindarajua82203f2011-02-21 03:42:44 +000024;CHECK: unimp 12
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000025 %f = alloca %struct.foo_t, align 8
26 call void @make_foo(%struct.foo_t* noalias sret %f, i32 10, i32 20, i32 30) nounwind
David Blaikie79e6c742015-02-27 19:29:02 +000027 %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 0
David Blaikiea79ac142015-02-27 21:17:42 +000028 %1 = load i32, i32* %0, align 8
David Blaikie79e6c742015-02-27 19:29:02 +000029 %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +000030 %3 = load i32, i32* %2, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000031 %4 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 2
David Blaikiea79ac142015-02-27 21:17:42 +000032 %5 = load i32, i32* %4, align 8
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000033 %6 = add nsw i32 %3, %1
34 %7 = add nsw i32 %6, %5
35 ret i32 %7
36}