File: brind.ll

package info (click to toggle)
llvm-2.7 2.7-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 59,992 kB
  • ctags: 49,499
  • sloc: cpp: 373,792; ansic: 16,885; sh: 12,614; asm: 6,809; ada: 3,083; ml: 2,942; python: 2,671; perl: 2,404; makefile: 1,691; pascal: 1,235; exp: 399; objc: 291; lisp: 184; csh: 117; xml: 38; f90: 36
file content (73 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
; Ensure that the select instruction is supported and is lowered to 
; some sort of branch instruction.
;
; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s

declare i32 @printf(i8*, ...)
@MSG = internal constant [13 x i8] c"Message: %d\0A\00"

@BLKS = private constant [5 x i8*]
    [ i8* blockaddress(@brind, %L1),
      i8* blockaddress(@brind, %L2),
      i8* blockaddress(@brind, %L3),
      i8* blockaddress(@brind, %L4),
      i8* blockaddress(@brind, %L5) ]

define i32 @brind(i32 %a, i32 %b)
{
    ; CHECK:        brind:
entry:
    br label %loop

loop:
    %tmp.0 = phi i32 [ 0, %entry ], [ %tmp.8, %finish ]
    %dst.0 = getelementptr [5 x i8*]* @BLKS, i32 0, i32 %tmp.0
    %dst.1 = load i8** %dst.0
    indirectbr i8* %dst.1, [ label %L1,
                             label %L2,
                             label %L3,
                             label %L4,
                             label %L5 ]
    ; CHECK:        br {{r[0-9]*}}

L1:
    %tmp.1 = add i32 %a, %b
    br label %finish
    ; CHECK:        br

L2:
    %tmp.2 = sub i32 %a, %b
    br label %finish
    ; CHECK:        br

L3:
    %tmp.3 = mul i32 %a, %b
    br label %finish
    ; CHECK:        br

L4:
    %tmp.4 = sdiv i32 %a, %b
    br label %finish
    ; CHECK:        br

L5:
    %tmp.5 = srem i32 %a, %b
    br label %finish
    ; CHECK:        br

finish:
    %tmp.6 = phi i32 [ %tmp.1, %L1 ],
                     [ %tmp.2, %L2 ],
                     [ %tmp.3, %L3 ],
                     [ %tmp.4, %L4 ],
                     [ %tmp.5, %L5 ]

    call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
                                 i32 %tmp.6)

    %tmp.7 = add i32 %tmp.0, 1
    %tmp.8 = urem i32 %tmp.7, 5

    br label %loop
    ; CHECK:        br
}