Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: test/CodeGen/ARM/sub-cmp-peephole.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/CodeGen/ARM/fast-isel-align.ll ('k') | test/CodeGen/ARM/varargs-spill-stack-align-nacl.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s 1 ; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s
2 ; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s --check-prefix=V7 2 ; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s --check-prefix=V7
3 ; RUN: llc < %s -mtriple=armv8-none-linux-gnueabi | FileCheck %s -check-prefix=V 8 3 ; RUN: llc < %s -mtriple=armv8-none-linux-gnueabi | FileCheck %s -check-prefix=V 8
4 4
5 5
6 define i32 @f(i32 %a, i32 %b) nounwind ssp { 6 define i32 @f(i32 %a, i32 %b) nounwind ssp {
7 entry: 7 entry:
8 ; CHECK-LABEL: f: 8 ; CHECK-LABEL: f:
9 ; CHECK: subs 9 ; CHECK: subs
10 ; CHECK-NOT: cmp 10 ; CHECK-NOT: cmp
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 %cmp1 = icmp eq i32 %retval.0.i, 0 81 %cmp1 = icmp eq i32 %retval.0.i, 0
82 br i1 %cmp1, label %land.lhs.true, label %if.end11 82 br i1 %cmp1, label %land.lhs.true, label %if.end11
83 83
84 land.lhs.true: ; preds = %num2long.exit 84 land.lhs.true: ; preds = %num2long.exit
85 ret i32 17 85 ret i32 17
86 86
87 if.end11: ; preds = %num2long.exit 87 if.end11: ; preds = %num2long.exit
88 ret i32 23 88 ret i32 23
89 } 89 }
90 90
91 ; When considering the producer of cmp's src as the subsuming instruction,
92 ; only consider that when the comparison is to 0.
93 define i32 @cmp_src_nonzero(i32 %a, i32 %b, i32 %x, i32 %y) {
94 entry:
95 ; CHECK-LABEL: cmp_src_nonzero:
96 ; CHECK: sub
97 ; CHECK: cmp
98 %sub = sub i32 %a, %b
99 %cmp = icmp eq i32 %sub, 17
100 %ret = select i1 %cmp, i32 %x, i32 %y
101 ret i32 %ret
102 }
103
91 define float @float_sel(i32 %a, i32 %b, float %x, float %y) { 104 define float @float_sel(i32 %a, i32 %b, float %x, float %y) {
92 entry: 105 entry:
93 ; CHECK-LABEL: float_sel: 106 ; CHECK-LABEL: float_sel:
94 ; CHECK-NOT: cmp 107 ; CHECK-NOT: cmp
95 ; V8-LABEL: float_sel: 108 ; V8-LABEL: float_sel:
96 ; V8-NOT: cmp 109 ; V8-NOT: cmp
97 ; V8: vseleq.f32 110 ; V8: vseleq.f32
98 %sub = sub i32 %a, %b 111 %sub = sub i32 %a, %b
99 %cmp = icmp eq i32 %sub, 0 112 %cmp = icmp eq i32 %sub, 0
100 %ret = select i1 %cmp, float %x, float %y 113 %ret = select i1 %cmp, float %x, float %y
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ; V8-LABEL: double_sub_swap: 150 ; V8-LABEL: double_sub_swap:
138 ; V8-NOT: subs 151 ; V8-NOT: subs
139 ; V8: cmp 152 ; V8: cmp
140 ; V8: vsel 153 ; V8: vsel
141 %cmp = icmp sgt i32 %a, %b 154 %cmp = icmp sgt i32 %a, %b
142 %sub = sub i32 %b, %a 155 %sub = sub i32 %b, %a
143 %ret = select i1 %cmp, double %x, double %y 156 %ret = select i1 %cmp, double %x, double %y
144 store i32 %sub, i32* @t 157 store i32 %sub, i32* @t
145 ret double %ret 158 ret double %ret
146 } 159 }
160
161 declare void @abort()
162 declare void @exit(i32)
163
164 ; If the comparison uses the V bit (signed overflow/underflow), we can't
165 ; omit the comparison.
166 define i32 @cmp_slt0(i32 %a, i32 %b, i32 %x, i32 %y) {
167 entry:
168 ; CHECK-LABEL: cmp_slt0
169 ; CHECK: sub
170 ; CHECK: cmp
171 ; CHECK: bge
172 %load = load i32* @t, align 4
173 %sub = sub i32 %load, 17
174 %cmp = icmp slt i32 %sub, 0
175 br i1 %cmp, label %if.then, label %if.else
176
177 if.then:
178 call void @abort()
179 unreachable
180
181 if.else:
182 call void @exit(i32 0)
183 unreachable
184 }
185
186 ; Same for the C bit. (Note the ult X, 0 is trivially
187 ; false, so the DAG combiner may or may not optimize it).
188 define i32 @cmp_ult0(i32 %a, i32 %b, i32 %x, i32 %y) {
189 entry:
190 ; CHECK-LABEL: cmp_ult0
191 ; CHECK: sub
192 ; CHECK: cmp
193 ; CHECK: bhs
194 %load = load i32* @t, align 4
195 %sub = sub i32 %load, 17
196 %cmp = icmp ult i32 %sub, 0
197 br i1 %cmp, label %if.then, label %if.else
198
199 if.then:
200 call void @abort()
201 unreachable
202
203 if.else:
204 call void @exit(i32 0)
205 unreachable
206 }
OLDNEW
« no previous file with comments | « test/CodeGen/ARM/fast-isel-align.ll ('k') | test/CodeGen/ARM/varargs-spill-stack-align-nacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698