blob: 7798e0f56aac5f9b95423bcdd8af9a81c1766a53 [file] [log] [blame]
Wesley Pecka70f28c2010-02-23 19:15:24 +00001; Ensure that the select instruction is supported and is lowered to
2; some sort of branch instruction.
3;
4; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
5
6declare i32 @printf(i8*, ...)
7@MSG = internal constant [13 x i8] c"Message: %d\0A\00"
8
9@BLKS = private constant [5 x i8*]
10 [ i8* blockaddress(@brind, %L1),
11 i8* blockaddress(@brind, %L2),
12 i8* blockaddress(@brind, %L3),
13 i8* blockaddress(@brind, %L4),
14 i8* blockaddress(@brind, %L5) ]
15
16define i32 @brind(i32 %a, i32 %b)
17{
18 ; CHECK: brind:
19entry:
20 br label %loop
21
22loop:
23 %tmp.0 = phi i32 [ 0, %entry ], [ %tmp.8, %finish ]
24 %dst.0 = getelementptr [5 x i8*]* @BLKS, i32 0, i32 %tmp.0
25 %dst.1 = load i8** %dst.0
26 indirectbr i8* %dst.1, [ label %L1,
27 label %L2,
28 label %L3,
29 label %L4,
30 label %L5 ]
31 ; CHECK: br {{r[0-9]*}}
32
33L1:
34 %tmp.1 = add i32 %a, %b
35 br label %finish
36 ; CHECK: br
37
38L2:
39 %tmp.2 = sub i32 %a, %b
40 br label %finish
41 ; CHECK: br
42
43L3:
44 %tmp.3 = mul i32 %a, %b
45 br label %finish
46 ; CHECK: br
47
48L4:
49 %tmp.4 = sdiv i32 %a, %b
50 br label %finish
51 ; CHECK: br
52
53L5:
54 %tmp.5 = srem i32 %a, %b
55 br label %finish
56 ; CHECK: br
57
58finish:
59 %tmp.6 = phi i32 [ %tmp.1, %L1 ],
60 [ %tmp.2, %L2 ],
61 [ %tmp.3, %L3 ],
62 [ %tmp.4, %L4 ],
63 [ %tmp.5, %L5 ]
64
65 call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
66 i32 %tmp.6)
67
68 %tmp.7 = add i32 %tmp.0, 1
69 %tmp.8 = urem i32 %tmp.7, 5
70
71 br label %loop
72 ; CHECK: br
73}