llvm.org GIT mirror llvm / 26e8ca3
Add testcase for PR11107. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141607 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
1 changed file(s) with 49 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llc < %s -mtriple thumbv7-apple-ios5.0.0 | FileCheck %s
1 ; PR11107
2
3 %struct.huffcodetab = type { i32, i32, i32*, i8* }
4
5 @ht = external global [34 x %struct.huffcodetab]
6
7 define i32 @func(i32 %table_select, i32 %x, i32 %y, i32* %code) nounwind {
8 entry:
9 ; CHECK: BB#0:
10 ; CHECK: movs.w
11 ; CHECK-NEXT: it mi
12 ; CHECK-NEXT: rsbmi
13 ; CHECK-NEXT: movs.w
14 ; CHECK-NEXT: it mi
15 ; CHECK-NEXT: rsbmi
16 %cmp.i = icmp sgt i32 %x, 0
17 %mul.i = sub i32 0, %x
18 %mul.i6 = select i1 %cmp.i, i32 %x, i32 %mul.i
19 %tmp = select i1 %cmp.i, i32 0, i32 1
20 %cmp.i1 = icmp sgt i32 %y, 0
21 %mul.i3 = sub i32 0, %y
22 %mul.i38 = select i1 %cmp.i1, i32 %y, i32 %mul.i3
23 br label %if.then3
24
25 if.then3: ; preds = %if.end
26 %xlen = getelementptr inbounds [34 x %struct.huffcodetab]* @ht, i32 0, i32 %table_select, i32 0
27 %tmp2 = load i32* %xlen, align 4, !tbaa !0
28 %sub = add nsw i32 %mul.i6, -15
29 %cmp4 = icmp sgt i32 %mul.i6, 14
30 %mul.i7 = select i1 %cmp4, i32 15, i32 %mul.i6
31 %sub9 = add nsw i32 %mul.i38, -15
32 %cmp7 = icmp sgt i32 %mul.i38, 14
33 %mul.i39 = select i1 %cmp7, i32 15, i32 %mul.i38
34 %mul = shl nsw i32 %mul.i7, 4
35 %add = add nsw i32 %mul, %mul.i39
36 %table = getelementptr inbounds [34 x %struct.huffcodetab]* @ht, i32 0, i32 %table_select, i32 2
37 %tmp3 = load i32** %table, align 4, !tbaa !3
38 %arrayidx11 = getelementptr inbounds i32* %tmp3, i32 %add
39 %tmp4 = load i32* %arrayidx11, align 4, !tbaa !4
40 store i32 %tmp4, i32* %code, align 4, !tbaa !0
41 ret i32 42
42 }
43
44 !0 = metadata !{metadata !"int", metadata !1}
45 !1 = metadata !{metadata !"omnipotent char", metadata !2}
46 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
47 !3 = metadata !{metadata !"any pointer", metadata !1}
48 !4 = metadata !{metadata !"long", metadata !1}