llvm.org GIT mirror llvm / 10d547a
[InstCombine] Add test cases for PR42691. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366611 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper a month ago
1 changed file(s) with 83 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
252252 ret void
253253 }
254254
255 define i1 @PR42691_1(i32 %x) {
256 ; CHECK-LABEL: @PR42691_1(
257 ; CHECK-NEXT: [[C1:%.*]] = icmp slt i32 %x, 0
258 ; CHECK-NEXT: [[C2:%.*]] = icmp eq i32 %x, 2147483647
259 ; CHECK-NEXT: [[C:%.*]] = or i1 [[C1]], [[C2]]
260 ; CHECK-NEXT: ret i1 [[C]]
261 ;
262 %c1 = icmp slt i32 %x, 0
263 %c2 = icmp eq i32 %x, 2147483647
264 %c = or i1 %c1, %c2
265 ret i1 %c
266 }
267
268 define i1 @PR42691_2(i32 %x) {
269 ; CHECK-LABEL: @PR42691_2(
270 ; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i32 %x, -2
271 ; CHECK-NEXT: ret i1 [[TMP1]]
272 ;
273 %c1 = icmp ult i32 %x, 2147483648
274 %c2 = icmp eq i32 %x, 4294967295
275 %c = or i1 %c1, %c2
276 ret i1 %c
277 }
278
279 define i1 @PR42691_3(i32 %x) {
280 ; CHECK-LABEL: @PR42691_3(
281 ; CHECK-NEXT: [[C1:%.*]] = icmp sgt i32 %x, -1
282 ; CHECK-NEXT: [[C2:%.*]] = icmp eq i32 %x, -2147483648
283 ; CHECK-NEXT: [[C:%.*]] = or i1 [[C1]], [[C2]]
284 ; CHECK-NEXT: ret i1 [[C]]
285 ;
286 %c1 = icmp sge i32 %x, 0
287 %c2 = icmp eq i32 %x, -2147483648
288 %c = or i1 %c1, %c2
289 ret i1 %c
290 }
291
292 define i1 @PR42691_4(i32 %x) {
293 ; CHECK-LABEL: @PR42691_4(
294 ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 %x, 1
295 ; CHECK-NEXT: ret i1 [[TMP1]]
296 ;
297 %c1 = icmp uge i32 %x, 2147483648
298 %c2 = icmp eq i32 %x, 0
299 %c = or i1 %c1, %c2
300 ret i1 %c
301 }
302
303 define i1 @PR42691_5(i32 %x) {
304 ; CHECK-LABEL: @PR42691_5(
305 ; CHECK-NEXT: [[C1:%.*]] = icmp slt i32 %x, 1
306 ; CHECK-NEXT: [[C2:%.*]] = icmp eq i32 %x, 2147483647
307 ; CHECK-NEXT: [[C:%.*]] = or i1 [[C1]], [[C2]]
308 ; CHECK-NEXT: ret i1 [[C]]
309 ;
310 %c1 = icmp slt i32 %x, 1
311 %c2 = icmp eq i32 %x, 2147483647
312 %c = or i1 %c1, %c2
313 ret i1 %c
314 }
315
316 define i1 @PR42691_6(i32 %x) {
317 ; CHECK-LABEL: @PR42691_6(
318 ; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i32 %x, -2
319 ; CHECK-NEXT: ret i1 [[TMP1]]
320 ;
321 %c1 = icmp ult i32 %x, 2147483648
322 %c2 = icmp eq i32 %x, 4294967295
323 %c = or i1 %c1, %c2
324 ret i1 %c
325 }
326
327 define i1 @PR42691_7(i32 %x) {
328 ; CHECK-LABEL: @PR42691_7(
329 ; CHECK-NEXT: [[TMP1:%.*]] = add i32 %x, -1
330 ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
331 ; CHECK-NEXT: ret i1 [[TMP2]]
332 ;
333 %c1 = icmp uge i32 %x, 2147483649
334 %c2 = icmp eq i32 %x, 0
335 %c = or i1 %c1, %c2
336 ret i1 %c
337 }