forked from OSchip/llvm-project
[InstCombine][test] add tests for icmp with constant and offset; NFC
This commit is contained in:
parent
230df8a419
commit
36bd25db3d
|
@ -747,3 +747,49 @@ define i1 @with_nuw_large_negative(i8 %x, i8 %y) {
|
|||
%tobool = icmp eq i8 %t2, %t1
|
||||
ret i1 %tobool
|
||||
}
|
||||
|
||||
define i1 @ugt_offset(i8 %a) {
|
||||
; CHECK-LABEL: @ugt_offset(
|
||||
; CHECK-NEXT: [[T:%.*]] = add i8 [[A:%.*]], 124
|
||||
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i8 [[T]], -5
|
||||
; CHECK-NEXT: ret i1 [[OV]]
|
||||
;
|
||||
%t = add i8 %a, 124
|
||||
%ov = icmp ugt i8 %t, 251
|
||||
ret i1 %ov
|
||||
}
|
||||
|
||||
define i1 @ugt_offset_use(i32 %a) {
|
||||
; CHECK-LABEL: @ugt_offset_use(
|
||||
; CHECK-NEXT: [[T:%.*]] = add i32 [[A:%.*]], 42
|
||||
; CHECK-NEXT: call void @use(i32 [[T]])
|
||||
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i32 [[T]], -2147483607
|
||||
; CHECK-NEXT: ret i1 [[OV]]
|
||||
;
|
||||
%t = add i32 %a, 42
|
||||
call void @use(i32 %t)
|
||||
%ov = icmp ugt i32 %t, 2147483689
|
||||
ret i1 %ov
|
||||
}
|
||||
|
||||
define <2 x i1> @ugt_offset_splat(<2 x i5> %a) {
|
||||
; CHECK-LABEL: @ugt_offset_splat(
|
||||
; CHECK-NEXT: [[T:%.*]] = add <2 x i5> [[A:%.*]], <i5 9, i5 9>
|
||||
; CHECK-NEXT: [[OV:%.*]] = icmp ugt <2 x i5> [[T]], <i5 -8, i5 -8>
|
||||
; CHECK-NEXT: ret <2 x i1> [[OV]]
|
||||
;
|
||||
%t = add <2 x i5> %a, <i5 9, i5 9>
|
||||
%ov = icmp ugt <2 x i5> %t, <i5 24, i5 24>
|
||||
ret <2 x i1> %ov
|
||||
}
|
||||
|
||||
define i1 @ugt_wrong_offset(i8 %a) {
|
||||
; CHECK-LABEL: @ugt_wrong_offset(
|
||||
; CHECK-NEXT: [[T:%.*]] = add i8 [[A:%.*]], 123
|
||||
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i8 [[T]], -5
|
||||
; CHECK-NEXT: ret i1 [[OV]]
|
||||
;
|
||||
%t = add i8 %a, 123
|
||||
%ov = icmp ugt i8 %t, 251
|
||||
ret i1 %ov
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue