Reapply r143206, with fixes. Disallow physical register lifetimes
[oota-llvm.git] / test / CodeGen / CellSPU / call_indirect.ll
1 ; RUN: llc < %s -march=cellspu -asm-verbose=0 -regalloc=linearscan > %t1.s
2 ; RUN: llc < %s -march=cellspu -mattr=large_mem -asm-verbose=0 -regalloc=linearscan > %t2.s
3 ; RUN: grep bisl    %t1.s | count 7
4 ; RUN: grep ila     %t1.s | count 1
5 ; RUN: grep rotqby  %t1.s | count 5
6 ; RUN: grep lqa     %t1.s | count 1
7 ; RUN: grep lqd     %t1.s | count 12
8 ; RUN: grep dispatch_tab %t1.s | count 5
9 ; RUN: grep bisl    %t2.s | count 7
10 ; RUN: grep ilhu    %t2.s | count 2
11 ; RUN: grep iohl    %t2.s | count 2
12 ; RUN: grep rotqby  %t2.s | count 5
13 ; RUN: grep lqd     %t2.s | count 13
14 ; RUN: grep ilhu    %t2.s | count 2
15 ; RUN: grep ai      %t2.s | count 9
16 ; RUN: grep dispatch_tab %t2.s | count 6
17
18 ; CellSPU legalization is over-sensitive to Legalize's traversal order.
19 ; XFAIL: *
20
21 ; ModuleID = 'call_indirect.bc'
22 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"
23 target triple = "spu-unknown-elf"
24
25 @dispatch_tab = global [6 x void (i32, float)*] zeroinitializer, align 16
26
27 define void @dispatcher(i32 %i_arg, float %f_arg) {
28 entry:
29         %tmp2 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 0), align 16
30         tail call void %tmp2( i32 %i_arg, float %f_arg )
31         %tmp2.1 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 1), align 4
32         tail call void %tmp2.1( i32 %i_arg, float %f_arg )
33         %tmp2.2 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 2), align 4
34         tail call void %tmp2.2( i32 %i_arg, float %f_arg )
35         %tmp2.3 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 3), align 4
36         tail call void %tmp2.3( i32 %i_arg, float %f_arg )
37         %tmp2.4 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 4), align 4
38         tail call void %tmp2.4( i32 %i_arg, float %f_arg )
39         %tmp2.5 = load void (i32, float)** getelementptr ([6 x void (i32, float)*]* @dispatch_tab, i32 0, i32 5), align 4
40         tail call void %tmp2.5( i32 %i_arg, float %f_arg )
41         ret void
42 }
43
44 @ptr_list = internal global [1 x void ()*] [ void ()* inttoptr (i64 4294967295 to void ()*) ], align 4
45 @ptr.a = internal global void ()** getelementptr ([1 x void ()*]* @ptr_list, i32 0, i32 1), align 16
46
47 define void @double_indirect_call() {
48         %a = load void ()*** @ptr.a, align 16
49         %b = load void ()** %a, align 4
50         tail call void %b()
51         ret void
52 }