[InstCombine] add tests for missing vector icmp folds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2016-08-15 19:16:33 +00:00
parent bb8ab1ab78
commit 7016f855b3
2 changed files with 48 additions and 0 deletions

View File

@ -14,3 +14,15 @@ define i1 @test(i32 %tmp6) {
ret i1 %1
}
; FIXME: Vectors should fold the same way.
define <2 x i1> @test_vec(<2 x i32> %tmp6) {
; CHECK-LABEL: @test_vec(
; CHECK-NEXT: [[TMP7:%.*]] = sdiv <2 x i32> %tmp6, <i32 12, i32 12>
; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i32> [[TMP7]], <i32 -6, i32 -6>
; CHECK-NEXT: ret <2 x i1> [[TMP1]]
;
%tmp7 = sdiv <2 x i32> %tmp6, <i32 12, i32 12>
icmp ne <2 x i32> %tmp7, <i32 -6, i32 -6>
ret <2 x i1> %1
}

View File

@ -72,6 +72,18 @@ define i1 @test7(i32 %A) {
ret i1 %C
}
; FIXME: Vectors should fold the same way.
define <2 x i1> @test7vec(<2 x i32> %A) {
; CHECK-LABEL: @test7vec(
; CHECK-NEXT: [[B:%.*]] = udiv <2 x i32> %A, <i32 10, i32 10>
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[B]], <i32 2, i32 2>
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%B = udiv <2 x i32> %A, <i32 10, i32 10>
%C = icmp eq <2 x i32> %B, <i32 2, i32 2>
ret <2 x i1> %C
}
define i1 @test8(i8 %A) {
; CHECK-LABEL: @test8(
; CHECK-NEXT: [[C:%.*]] = icmp ugt i8 %A, -11
@ -83,6 +95,18 @@ define i1 @test8(i8 %A) {
ret i1 %C
}
; FIXME: Vectors should fold the same way.
define <2 x i1> @test8vec(<2 x i8> %A) {
; CHECK-LABEL: @test8vec(
; CHECK-NEXT: [[B:%.*]] = udiv <2 x i8> %A, <i8 123, i8 123>
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i8> [[B]], <i8 2, i8 2>
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%B = udiv <2 x i8> %A, <i8 123, i8 123>
%C = icmp eq <2 x i8> %B, <i8 2, i8 2>
ret <2 x i1> %C
}
define i1 @test9(i8 %A) {
; CHECK-LABEL: @test9(
; CHECK-NEXT: [[C:%.*]] = icmp ult i8 %A, -10
@ -94,6 +118,18 @@ define i1 @test9(i8 %A) {
ret i1 %C
}
; FIXME: Vectors should fold the same way.
define <2 x i1> @test9vec(<2 x i8> %A) {
; CHECK-LABEL: @test9vec(
; CHECK-NEXT: [[B:%.*]] = udiv <2 x i8> %A, <i8 123, i8 123>
; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i8> [[B]], <i8 2, i8 2>
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%B = udiv <2 x i8> %A, <i8 123, i8 123>
%C = icmp ne <2 x i8> %B, <i8 2, i8 2>
ret <2 x i1> %C
}
define i32 @test10(i32 %X, i1 %C) {
; CHECK-LABEL: @test10(
; CHECK-NEXT: [[R_V:%.*]] = select i1 %C, i32 6, i32 3