pic-jumptables.ll
1.41 KB
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
; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
; CHECK: r{{[0-9]+}} = add({{pc|PC}},##
; CHECK: r{{[0-9]+}} = memw(r{{[0-9]+}}+r{{[0-9]+}}<<#2)
; CHECK: r{{[0-9]+}} = add(r{{[0-9]+}},r{{[0-9]+}})
define i32 @test(i32 %y) nounwind {
entry:
switch i32 %y, label %sw.epilog [
i32 1, label %sw.bb
i32 2, label %sw.bb1
i32 3, label %sw.bb2
i32 4, label %sw.bb3
i32 5, label %sw.bb4
]
sw.bb: ; preds = %entry
tail call void bitcast (void (...)* @baz1 to void ()*)() nounwind
br label %sw.epilog
sw.bb1: ; preds = %entry
tail call void @baz2(i32 2, i32 78) nounwind
br label %sw.epilog
sw.bb2: ; preds = %entry
tail call void @baz3(i32 59) nounwind
br label %sw.epilog
sw.bb3: ; preds = %entry
tail call void @baz4(i32 4, i32 14) nounwind
br label %sw.epilog
sw.bb4: ; preds = %entry
br label %sw.epilog
sw.epilog: ; preds = %sw.bb4, %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb, %entry
%y.addr.0 = phi i32 [ %y, %entry ], [ 14, %sw.bb4 ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, %sw.bb1 ], [ 1, %sw.bb ]
ret i32 %y.addr.0
}
declare void @baz1(...)
declare void @baz2(i32, i32)
declare void @baz3(i32)
declare void @baz4(i32, i32)