Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 1 | ;RUN: llc -march=sparc < %s | FileCheck %s |
| 2 | |
| 3 | %struct.foo_t = type { i32, i32, i32 } |
| 4 | |
| 5 | define weak void @make_foo(%struct.foo_t* noalias sret %agg.result, i32 %a, i32 %b, i32 %c) nounwind { |
| 6 | entry: |
Stephen Lin | 6f36b45 | 2013-07-18 22:47:09 +0000 | [diff] [blame] | 7 | ;CHECK-LABEL: make_foo: |
Venkatraman Govindaraju | 3e8c7d9 | 2013-06-02 02:24:27 +0000 | [diff] [blame] | 8 | ;CHECK: ld [%sp+64], {{.+}} |
| 9 | ;CHECK: jmp %o7+12 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 10 | %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 0 |
Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 11 | store i32 %a, i32* %0, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 12 | %1 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 1 |
Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 13 | store i32 %b, i32* %1, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 14 | %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %agg.result, i32 0, i32 2 |
Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 15 | store i32 %c, i32* %2, align 4 |
| 16 | ret void |
| 17 | } |
| 18 | |
| 19 | define i32 @test() nounwind { |
| 20 | entry: |
Stephen Lin | 6f36b45 | 2013-07-18 22:47:09 +0000 | [diff] [blame] | 21 | ;CHECK-LABEL: test: |
Stephen Lin | 98cbca2 | 2013-07-18 22:29:15 +0000 | [diff] [blame] | 22 | ;CHECK: call make_foo |
James Y Knight | 1f3e6af | 2015-09-10 21:49:06 +0000 | [diff] [blame] | 23 | ;CHECK: st {{.+}}, [%sp+64] |
Venkatraman Govindaraju | a82203f | 2011-02-21 03:42:44 +0000 | [diff] [blame] | 24 | ;CHECK: unimp 12 |
Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 25 | %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 Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 27 | %0 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 28 | %1 = load i32, i32* %0, align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 29 | %2 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 1 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 30 | %3 = load i32, i32* %2, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 31 | %4 = getelementptr inbounds %struct.foo_t, %struct.foo_t* %f, i32 0, i32 2 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 32 | %5 = load i32, i32* %4, align 8 |
Venkatraman Govindaraju | cc91b7a | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 33 | %6 = add nsw i32 %3, %1 |
| 34 | %7 = add nsw i32 %6, %5 |
| 35 | ret i32 %7 |
| 36 | } |