1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s
4 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
5 target triple = "thumbv7s-apple-unknown"
7 ; The subtract instruction %3 will be optimized (combined and predicated) with the select
8 ; inside the loop. In this case, the kill flag on the subtract should be removed or else
9 ; it will fail verification.
11 %struct.PROOFSEARCH_HELP = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32 }
12 %struct.SORTTHEORY_HELP = type { ptr, [4000 x ptr], ptr, ptr, i32 }
13 %struct.st = type { ptr, ptr, ptr, i16, i16 }
14 %struct.subst = type { ptr, i32, ptr }
15 %struct.term = type { i32, %union.anon, ptr, i32, i32 }
16 %union.anon = type { ptr }
17 %struct.NODE_HELP = type { ptr, i32, i32, i32, ptr, i32 }
18 %struct.SHARED_INDEX_NODE = type { ptr, [3001 x ptr], [4000 x ptr], i32 }
19 %struct.LIST_HELP = type { ptr, ptr }
20 %struct.CLAUSE_HELP = type { i32, i32, i32, i32, ptr, i32, ptr, ptr, i32, i32, ptr, i32, i32, i32, i32 }
21 %struct.LITERAL_HELP = type { i32, i32, i32, ptr, ptr }
23 declare void @foo(ptr, ptr)
25 define hidden fastcc ptr @test(ptr %Search, ptr %ClauseList, i32 %Level, ptr nocapture %New) {
27 ; CHECK: @ %bb.0: @ %entry
28 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, lr}
29 ; CHECK-NEXT: sub sp, #4
30 ; CHECK-NEXT: sub.w r7, r2, #32
31 ; CHECK-NEXT: mov r8, r0
32 ; CHECK-NEXT: movs r0, #1
33 ; CHECK-NEXT: mov r4, r2
34 ; CHECK-NEXT: add.w r6, r0, r7, lsr #5
35 ; CHECK-NEXT: mov r5, r1
36 ; CHECK-NEXT: mov.w r9, #0
37 ; CHECK-NEXT: b .LBB0_2
38 ; CHECK-NEXT: .LBB0_1: @ %for.inc
39 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
40 ; CHECK-NEXT: ldr r5, [r5]
41 ; CHECK-NEXT: .LBB0_2: @ %for.body
42 ; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
43 ; CHECK-NEXT: ldr r1, [r5, #4]
44 ; CHECK-NEXT: mov r2, r4
45 ; CHECK-NEXT: cmp r4, #31
46 ; CHECK-NEXT: ldr r0, [r1, #16]
47 ; CHECK-NEXT: add.w r0, r0, r6, lsl #2
48 ; CHECK-NEXT: ldr r0, [r0, #40]
50 ; CHECK-NEXT: andhi r2, r7, #31
51 ; CHECK-NEXT: lsrs r0, r2
52 ; CHECK-NEXT: lsls r0, r0, #31
53 ; CHECK-NEXT: beq .LBB0_1
54 ; CHECK-NEXT: @ %bb.3: @ %if.then
55 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
56 ; CHECK-NEXT: mov r0, r8
58 ; CHECK-NEXT: str.w r9, [r5, #4]
59 ; CHECK-NEXT: b .LBB0_1
61 %cmp4.i.i = icmp ugt i32 %Level, 31
62 %i = add i32 %Level, -32
64 %i2 = shl nuw i32 %i1, 5
66 %i4 = add nuw nsw i32 %i1, 1
69 for.body: ; preds = %for.inc, %entry
70 %Scan.038 = phi ptr [ %ClauseList, %entry ], [ %i9, %for.inc ]
71 %car.i33 = getelementptr inbounds %struct.LIST_HELP, ptr %Scan.038, i32 0, i32 1
72 %i6 = load ptr, ptr %car.i33, align 4
74 %.Level = select i1 %cmp4.i.i, i32 %i3, i32 %Level
75 %splitfield.i = getelementptr inbounds %struct.CLAUSE_HELP, ptr %i6, i32 0, i32 4
76 %i7 = load ptr, ptr %splitfield.i, align 4
77 %arrayidx.i = getelementptr inbounds i32, ptr %i7, i32 %.
78 %i8 = load i32, ptr %arrayidx.i, align 4
79 %shl.i = shl i32 1, %.Level
80 %and.i = and i32 %i8, %shl.i
81 %cmp4.i = icmp eq i32 %and.i, 0
82 br i1 %cmp4.i, label %for.inc, label %if.then
84 if.then: ; preds = %for.body
85 tail call void @foo(ptr %Search, ptr %i6)
86 store ptr null, ptr %car.i33, align 4
89 for.inc: ; preds = %if.then, %for.body
90 %cdr.i = getelementptr inbounds %struct.LIST_HELP, ptr %Scan.038, i32 0, i32 0
91 %i9 = load ptr, ptr %cdr.i, align 4