llvm.org GIT mirror llvm / 3606f75
Test simplification that Ana Pazos noticed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141644 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
1 changed file(s) with 10 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llc < %s -mtriple thumbv7-apple-ios5.0.0 | FileCheck %s
0 ; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck %s
11 ; PR11107
22
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 {
3 define i32 @test(i32 %a, i32 %b) {
84 entry:
9 ; CHECK: BB#0:
105 ; CHECK: movs.w
116 ; CHECK-NEXT: it mi
127 ; CHECK-NEXT: rsbmi
138 ; CHECK-NEXT: movs.w
149 ; CHECK-NEXT: it mi
1510 ; 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
11 %cmp1 = icmp slt i32 %a, 0
12 %sub1 = sub nsw i32 0, %a
13 %abs1 = select i1 %cmp1, i32 %sub1, i32 %a
14 %cmp2 = icmp slt i32 %b, 0
15 %sub2 = sub nsw i32 0, %b
16 %abs2 = select i1 %cmp2, i32 %sub2, i32 %b
17 %add = add nsw i32 %abs1, %abs2
18 ret i32 %add
4219 }
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}