[InstCombine] Signed saturation patterns
[llvm-core.git] / test / CodeGen / Thumb2 / LowOverheadLoops / no-dec-reorder.mir
blobffabd94c9344748aa5aecc3cfffcfdc90e33b122
1 # RUN: llc -mtriple=thumbv8.1m.main %s -run-pass=arm-cp-islands --verify-machineinstrs -o - | FileCheck %s
2 # CHECK-NOT: t2LE
4 --- |
5   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6   target triple = "thumbv8.1m.main-unknown-unknown"
7   
8   %struct.head_s = type { %struct.head_s*, %struct.data_s* }
9   %struct.data_s = type { i16, i16 }
10   
11   ; Function Attrs: norecurse nounwind readonly
12   define dso_local arm_aapcscc %struct.head_s* @search(%struct.head_s* readonly %list, %struct.data_s* nocapture readonly %info) local_unnamed_addr #0 {
13   entry:
14     %idx = getelementptr inbounds %struct.data_s, %struct.data_s* %info, i32 0, i32 1
15     %tmp = load i16, i16* %idx, align 2
16     %cmp = icmp sgt i16 %tmp, -1
17     br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader
18   
19   while.cond9.preheader:                            ; preds = %entry
20     %0 = icmp eq %struct.head_s* %list, null
21     br i1 %0, label %return, label %land.rhs11.lr.ph
22   
23   land.rhs11.lr.ph:                                 ; preds = %while.cond9.preheader
24     %data16143 = bitcast %struct.data_s* %info to i16*
25     %tmp1 = load i16, i16* %data16143, align 2
26     %conv15 = sext i16 %tmp1 to i32
27     br label %land.rhs11
28   
29   while.cond.preheader:                             ; preds = %entry
30     %1 = icmp eq %struct.head_s* %list, null
31     br i1 %1, label %return, label %land.rhs.preheader
32   
33   land.rhs.preheader:                               ; preds = %while.cond.preheader
34     br label %land.rhs
35   
36   while.body:                                       ; preds = %land.rhs
37     %next4 = bitcast %struct.head_s* %list.addr.033 to %struct.head_s**
38     %tmp4 = load %struct.head_s*, %struct.head_s** %next4, align 4
39     %tobool = icmp eq %struct.head_s* %tmp4, null
40     br i1 %tobool, label %return, label %land.rhs
41   
42   land.rhs:                                         ; preds = %land.rhs.preheader, %while.body
43     %list.addr.033 = phi %struct.head_s* [ %tmp4, %while.body ], [ %list, %land.rhs.preheader ]
44     %info2 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.033, i32 0, i32 1
45     %tmp2 = load %struct.data_s*, %struct.data_s** %info2, align 4
46     %idx3 = getelementptr inbounds %struct.data_s, %struct.data_s* %tmp2, i32 0, i32 1
47     %tmp3 = load i16, i16* %idx3, align 2
48     %cmp7 = icmp eq i16 %tmp3, %tmp
49     br i1 %cmp7, label %return, label %while.body
50   
51   while.body19:                                     ; preds = %land.rhs11
52     %next205 = bitcast %struct.head_s* %list.addr.136 to %struct.head_s**
53     %tmp8 = load %struct.head_s*, %struct.head_s** %next205, align 4
54     %tobool10 = icmp eq %struct.head_s* %tmp8, null
55     br i1 %tobool10, label %return, label %land.rhs11
56   
57   land.rhs11:                                       ; preds = %while.body19, %land.rhs11.lr.ph
58     %list.addr.136 = phi %struct.head_s* [ %list, %land.rhs11.lr.ph ], [ %tmp8, %while.body19 ]
59     %info12 = getelementptr inbounds %struct.head_s, %struct.head_s* %list.addr.136, i32 0, i32 1
60     %tmp5 = load %struct.data_s*, %struct.data_s** %info12, align 4
61     %data166 = bitcast %struct.data_s* %tmp5 to i16*
62     %tmp6 = load i16, i16* %data166, align 2
63     %2 = and i16 %tmp6, 255
64     %and = zext i16 %2 to i32
65     %cmp16 = icmp eq i32 %and, %conv15
66     br i1 %cmp16, label %return, label %while.body19
67   
68   return:                                           ; preds = %land.rhs11, %while.body19, %land.rhs, %while.body, %while.cond.preheader, %while.cond9.preheader
69     %retval.0 = phi %struct.head_s* [ null, %while.cond.preheader ], [ null, %while.cond9.preheader ], [ %list.addr.033, %land.rhs ], [ null, %while.body ], [ %list.addr.136, %land.rhs11 ], [ null, %while.body19 ]
70     ret %struct.head_s* %retval.0
71   }
72   
73   attributes #0 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+armv8.1-m.main,+hwdiv,+lob,+ras,+soft-float,+strict-align,+thumb-mode,-crypto,-d32,-dotprod,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-neon,-vfp2,-vfp2d16,-vfp2d16sp,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "unsafe-fp-math"="false" "use-soft-float"="true" }
74   
75 ...
76 ---
77 name:            search
78 alignment:       1
79 exposesReturnsTwice: false
80 legalized:       false
81 regBankSelected: false
82 selected:        false
83 failedISel:      false
84 tracksRegLiveness: true
85 hasWinCFI:       false
86 registers:       []
87 liveins:
88   - { reg: '$r0', virtual-reg: '' }
89   - { reg: '$r1', virtual-reg: '' }
90 frameInfo:
91   isFrameAddressTaken: false
92   isReturnAddressTaken: false
93   hasStackMap:     false
94   hasPatchPoint:   false
95   stackSize:       0
96   offsetAdjustment: 0
97   maxAlignment:    1
98   adjustsStack:    false
99   hasCalls:        false
100   stackProtector:  ''
101   maxCallFrameSize: 0
102   cvBytesOfCalleeSavedRegisters: 0
103   hasOpaqueSPAdjustment: false
104   hasVAStart:      false
105   hasMustTailInVarArgFunc: false
106   localFrameSize:  0
107   savePoint:       ''
108   restorePoint:    ''
109 fixedStack:      []
110 stack:           []
111 callSites:       []
112 constants:       []
113 machineFunctionInfo: {}
114 body:             |
115   bb.0.entry:
116     successors: %bb.3(0x50000000), %bb.1(0x30000000)
117     liveins: $r0, $r1
118   
119     renamable $r2 = t2LDRSHi12 renamable $r1, 2, 14, $noreg :: (load 2 from %ir.idx)
120     t2CMPri renamable $r2, -1, 14, $noreg, implicit-def $cpsr
121     t2Bcc %bb.1, 13, killed $cpsr
122   
123   bb.3.while.cond.preheader:
124     successors: %bb.4(0x80000000)
125     liveins: $r0, $r2
126   
127     tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
128     t2IT 0, 4, implicit-def $itstate
129     renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
130     tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
131     renamable $r1 = tUXTH killed renamable $r2, 14, $noreg
132   
133   bb.4.land.rhs:
134     successors: %bb.6(0x04000000), %bb.5(0x7c000000)
135     liveins: $r0, $r1
136   
137     renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load 4 from %ir.info2)
138     renamable $r2 = tLDRHi killed renamable $r2, 1, 14, $noreg :: (load 2 from %ir.idx3)
139     tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
140     t2Bcc %bb.6, 0, killed $cpsr
141   
142   bb.5.while.body:
143     successors: %bb.4(0x7c000000)
144     liveins: $r0, $r1
145   
146     renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load 4 from %ir.next4)
147     tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
148     t2IT 0, 4, implicit-def $itstate
149     renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
150     tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
151     t2B %bb.4, 14, $noreg
152   
153   bb.6.return:
154     liveins: $r0
155   
156     tBX_RET 14, $noreg, implicit $r0
157   
158   bb.1.while.cond9.preheader:
159     successors: %bb.2(0x80000000)
160     liveins: $r0, $r1
161   
162     tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
163     t2IT 0, 4, implicit-def $itstate
164     renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
165     tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
166     renamable $r1 = t2LDRSHi12 killed renamable $r1, 0, 14, $noreg :: (load 2 from %ir.data16143)
167   
168   bb.2.land.rhs11:
169     successors: %bb.2(0x7c000000)
170     liveins: $r0, $r1
171   
172     renamable $r2 = tLDRi renamable $r0, 1, 14, $noreg :: (load 4 from %ir.info12)
173     renamable $r2 = tLDRBi killed renamable $r2, 0, 14, $noreg :: (load 1 from %ir.data166, align 2)
174     tCMPr killed renamable $r2, renamable $r1, 14, $noreg, implicit-def $cpsr
175     t2IT 0, 8, implicit-def $itstate
176     tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
177     renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load 4 from %ir.next205)
178     tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
179     t2IT 0, 4, implicit-def $itstate
180     renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
181     tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
182     t2B %bb.2, 14, $noreg