Kalle Raiskila | 951b229 | 2010-06-21 15:08:16 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=cellspu | FileCheck %s |
Scott Michel | 0a92af4 | 2007-12-19 20:50:49 +0000 | [diff] [blame] | 2 | |
| 3 | target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128" |
| 4 | target triple = "spu" |
| 5 | |
| 6 | define i32 @main() { |
| 7 | entry: |
| 8 | %a = call i32 @stub_1(i32 1, float 0x400921FA00000000) |
| 9 | call void @extern_stub_1(i32 %a, i32 4) |
| 10 | ret i32 %a |
| 11 | } |
| 12 | |
| 13 | declare void @extern_stub_1(i32, i32) |
| 14 | |
| 15 | define i32 @stub_1(i32 %x, float %y) { |
Kalle Raiskila | 951b229 | 2010-06-21 15:08:16 +0000 | [diff] [blame] | 16 | ; CHECK: il $3, 0 |
| 17 | ; CHECK: bi $lr |
Scott Michel | 0a92af4 | 2007-12-19 20:50:49 +0000 | [diff] [blame] | 18 | entry: |
| 19 | ret i32 0 |
| 20 | } |
Scott Michel | d976c21 | 2008-10-30 01:51:48 +0000 | [diff] [blame] | 21 | |
| 22 | ; vararg call: ensure that all caller-saved registers are spilled to the |
| 23 | ; stack: |
| 24 | define i32 @stub_2(...) { |
| 25 | entry: |
| 26 | ret i32 0 |
| 27 | } |
Kalle Raiskila | 55aebef | 2010-08-24 11:50:48 +0000 | [diff] [blame] | 28 | |
| 29 | ; check that struct is passed in r3-> |
| 30 | ; assert this by changing the second field in the struct |
| 31 | %0 = type { i32, i32, i32 } |
| 32 | declare %0 @callee() |
| 33 | define %0 @test_structret() |
| 34 | { |
| 35 | ;CHECK: stqd $lr, 16($sp) |
| 36 | ;CHECK: stqd $sp, -48($sp) |
| 37 | ;CHECK: ai $sp, $sp, -48 |
| 38 | ;CHECK: brasl $lr, callee |
| 39 | %rv = call %0 @callee() |
| 40 | ;CHECK: ai $4, $4, 1 |
| 41 | ;CHECK: lqd $lr, 64($sp) |
| 42 | ;CHECK: ai $sp, $sp, 48 |
| 43 | ;CHECK: bi $lr |
| 44 | %oldval = extractvalue %0 %rv, 1 |
| 45 | %newval = add i32 %oldval,1 |
| 46 | %newrv = insertvalue %0 %rv, i32 %newval, 1 |
| 47 | ret %0 %newrv |
| 48 | } |
| 49 | |