mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[InstCombine] add test for missed vector icmp fold; NFC
Also, move the related existing scalar test to a renamed file where I'm planning to add more icmp-add tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7d1045f0d4
commit
bddd84197f
@ -83,3 +83,26 @@ define <2 x i1> @test4vec(<2 x i32> %a) {
|
||||
ret <2 x i1> %c
|
||||
}
|
||||
|
||||
define i1 @slt_zero_add_nsw(i32 %a) {
|
||||
; CHECK-LABEL: @slt_zero_add_nsw(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, -1
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%add = add nsw i32 %a, 1
|
||||
%cmp = icmp slt i32 %add, 0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; FIXME: The same fold should work with vectors.
|
||||
|
||||
define <2 x i1> @slt_zero_add_nsw_splat_vec(<2 x i8> %a) {
|
||||
; CHECK-LABEL: @slt_zero_add_nsw_splat_vec(
|
||||
; CHECK-NEXT: [[ADD:%.*]] = add nsw <2 x i8> %a, <i8 1, i8 1>
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <2 x i8> [[ADD]], zeroinitializer
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%add = add nsw <2 x i8> %a, <i8 1, i8 1>
|
||||
%cmp = icmp slt <2 x i8> %add, zeroinitializer
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
@ -2231,16 +2231,6 @@ define i1 @icmp_sge_zero_add_nsw(i32 %a) {
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
define i1 @icmp_slt_zero_add_nsw(i32 %a) {
|
||||
; CHECK-LABEL: @icmp_slt_zero_add_nsw(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, -1
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%add = add nsw i32 %a, 1
|
||||
%cmp = icmp slt i32 %add, 0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
define i1 @icmp_sle_zero_add_nsw(i32 %a) {
|
||||
; CHECK-LABEL: @icmp_sle_zero_add_nsw(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %a, 0
|
||||
|
Loading…
Reference in New Issue
Block a user