aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/MBlaze/jumptable.ll
blob: 0861810a014ced8a7e09f0885f6c7c026c153f50 (plain)
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
74
75
76
77
78
79
; Ensure that jump tables can be handled by the mblaze backend. The
; jump table should be lowered to a "br" instruction using one of the
; available registers.
;
; RUN: llc < %s -march=mblaze | FileCheck %s

define i32 @jmptable(i32 %arg)
{
    ; CHECK:        jmptable:
    switch i32 %arg, label %DEFAULT [ i32 0, label %L0
                                      i32 1, label %L1
                                      i32 2, label %L2
                                      i32 3, label %L3
                                      i32 4, label %L4
                                      i32 5, label %L5
                                      i32 6, label %L6
                                      i32 7, label %L7
                                      i32 8, label %L8
                                      i32 9, label %L9 ]

    ; CHECK:        lw  [[REG:r[0-9]*]]
    ; CHECK:        brd [[REG]]
L0:
    %var0 = add i32 %arg, 0
    br label %DONE

L1:
    %var1 = add i32 %arg, 1
    br label %DONE

L2:
    %var2 = add i32 %arg, 2
    br label %DONE

L3:
    %var3 = add i32 %arg, 3
    br label %DONE

L4:
    %var4 = add i32 %arg, 4
    br label %DONE

L5:
    %var5 = add i32 %arg, 5
    br label %DONE

L6:
    %var6 = add i32 %arg, 6
    br label %DONE

L7:
    %var7 = add i32 %arg, 7
    br label %DONE

L8:
    %var8 = add i32 %arg, 8
    br label %DONE

L9:
    %var9 = add i32 %arg, 9
    br label %DONE

DEFAULT:
    unreachable

DONE:
    %rval = phi i32 [ %var0, %L0 ],
                    [ %var1, %L1 ],
                    [ %var2, %L2 ],
                    [ %var3, %L3 ],
                    [ %var4, %L4 ],
                    [ %var5, %L5 ],
                    [ %var6, %L6 ],
                    [ %var7, %L7 ],
                    [ %var8, %L8 ],
                    [ %var9, %L9 ]
    ret i32 %rval
    ; CHECK:        rtsd
}