Venkatraman Govindaraju | 8184e28 | 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: |
| 7 | ;CHECK: make_foo |
| 8 | ;CHECK: ld [%fp+64], {{.+}} |
| 9 | ;CHECK: or {{.+}}, {{.+}}, %i0 |
Venkatraman Govindaraju | 58269b9 | 2011-02-21 03:42:44 +0000 | [diff] [blame^] | 10 | ;CHECK: jmp %i7+12 |
Venkatraman Govindaraju | 8184e28 | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 11 | %0 = getelementptr inbounds %struct.foo_t* %agg.result, i32 0, i32 0 |
| 12 | store i32 %a, i32* %0, align 4 |
| 13 | %1 = getelementptr inbounds %struct.foo_t* %agg.result, i32 0, i32 1 |
| 14 | store i32 %b, i32* %1, align 4 |
| 15 | %2 = getelementptr inbounds %struct.foo_t* %agg.result, i32 0, i32 2 |
| 16 | store i32 %c, i32* %2, align 4 |
| 17 | ret void |
| 18 | } |
| 19 | |
| 20 | define i32 @test() nounwind { |
| 21 | entry: |
| 22 | ;CHECK: test |
| 23 | ;CHECK: st {{.+}}, [%sp+64] |
| 24 | ;CHECK: make_foo |
Venkatraman Govindaraju | 58269b9 | 2011-02-21 03:42:44 +0000 | [diff] [blame^] | 25 | ;CHECK: unimp 12 |
Venkatraman Govindaraju | 8184e28 | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 26 | %f = alloca %struct.foo_t, align 8 |
| 27 | call void @make_foo(%struct.foo_t* noalias sret %f, i32 10, i32 20, i32 30) nounwind |
| 28 | %0 = getelementptr inbounds %struct.foo_t* %f, i32 0, i32 0 |
| 29 | %1 = load i32* %0, align 8 |
| 30 | %2 = getelementptr inbounds %struct.foo_t* %f, i32 0, i32 1 |
| 31 | %3 = load i32* %2, align 4 |
| 32 | %4 = getelementptr inbounds %struct.foo_t* %f, i32 0, i32 2 |
| 33 | %5 = load i32* %4, align 8 |
| 34 | %6 = add nsw i32 %3, %1 |
| 35 | %7 = add nsw i32 %6, %5 |
| 36 | ret i32 %7 |
| 37 | } |