blob: 11cf770145ba0deda23be9a74a1256b455334262 [file] [log] [blame]
Kalle Raiskila951b2292010-06-21 15:08:16 +00001; RUN: llc < %s -march=cellspu | FileCheck %s
Scott Michel0a92af42007-12-19 20:50:49 +00002
3target 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"
4target triple = "spu"
5
6define i32 @main() {
7entry:
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
13declare void @extern_stub_1(i32, i32)
14
15define i32 @stub_1(i32 %x, float %y) {
Kalle Raiskila951b2292010-06-21 15:08:16 +000016 ; CHECK: il $3, 0
17 ; CHECK: bi $lr
Scott Michel0a92af42007-12-19 20:50:49 +000018entry:
19 ret i32 0
20}
Scott Micheld976c212008-10-30 01:51:48 +000021
22; vararg call: ensure that all caller-saved registers are spilled to the
23; stack:
24define i32 @stub_2(...) {
25entry:
26 ret i32 0
27}
Kalle Raiskila55aebef2010-08-24 11:50:48 +000028
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 }
32declare %0 @callee()
33define %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