1 ; Ensure that indirect calls work and that they are lowered to some
2 ; sort of branch and link instruction.
4 ; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
6 declare i32 @printf(i8*, ...)
7 @MSG = internal constant [13 x i8] c"Message: %d\0A\00"
9 @FUNS = private constant [5 x i32 (i32,i32)*]
10 [ i32 (i32,i32)* @doadd,
11 i32 (i32,i32)* @dosub,
12 i32 (i32,i32)* @domul,
13 i32 (i32,i32)* @dodiv,
14 i32 (i32,i32)* @dorem ]
16 define i32 @doadd(i32 %a, i32 %b)
19 %tmp.0 = add i32 %a, %b
24 define i32 @dosub(i32 %a, i32 %b)
27 %tmp.0 = sub i32 %a, %b
32 define i32 @domul(i32 %a, i32 %b)
35 %tmp.0 = mul i32 %a, %b
40 define i32 @dodiv(i32 %a, i32 %b)
43 %tmp.0 = sdiv i32 %a, %b
48 define i32 @dorem(i32 %a, i32 %b)
51 %tmp.0 = srem i32 %a, %b
56 define i32 @callind(i32 %a, i32 %b)
63 %tmp.0 = phi i32 [ 0, %entry ], [ %tmp.3, %loop ]
64 %dst.0 = getelementptr [5 x i32 (i32,i32)*]* @FUNS, i32 0, i32 %tmp.0
65 %dst.1 = load i32 (i32,i32)** %dst.0
66 %tmp.1 = call i32 %dst.1(i32 %a, i32 %b)
71 call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
75 %tmp.2 = add i32 %tmp.0, 1
76 %tmp.3 = urem i32 %tmp.2, 5