add tests for missing vector icmp folds

llvm-svn: 278132
This commit is contained in:
Sanjay Patel 2016-08-09 16:39:05 +00:00
parent f36a29199f
commit 9f36a2d54b
3 changed files with 60 additions and 0 deletions

View File

@ -33,6 +33,18 @@ define i1 @test3(i8 %x) {
ret i1 %tmp
}
; FIXME: Vectors should fold too.
define <2 x i1> @test3vec(<2 x i8> %x) {
; CHECK-LABEL: @test3vec(
; CHECK-NEXT: [[X:%.*]] = xor <2 x i8> %x, <i8 -128, i8 -128>
; CHECK-NEXT: [[TMP:%.*]] = icmp ugt <2 x i8> [[X]], <i8 14, i8 14>
; CHECK-NEXT: ret <2 x i1> [[TMP]]
;
%X = xor <2 x i8> %x, <i8 128, i8 128>
%tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
ret <2 x i1> %tmp
}
define i1 @test4(i8 %x, i8 %y) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[TMP:%.*]] = icmp ugt i8 %x, %y
@ -65,3 +77,15 @@ define i1 @test6(i8 %x) {
ret i1 %tmp
}
; FIXME: Vectors should fold too.
define <2 x i1> @test6vec(<2 x i8> %x) {
; CHECK-LABEL: @test6vec(
; CHECK-NEXT: [[X:%.*]] = xor <2 x i8> %x, <i8 127, i8 127>
; CHECK-NEXT: [[TMP:%.*]] = icmp ugt <2 x i8> [[X]], <i8 14, i8 14>
; CHECK-NEXT: ret <2 x i1> [[TMP]]
;
%X = xor <2 x i8> %x, <i8 127, i8 127>
%tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
ret <2 x i1> %tmp
}

View File

@ -1546,6 +1546,18 @@ define i1 @icmp_sub_-1_X_ult_4(i32 %X) {
ret i1 %cmp
}
; FIXME: Vectors should fold too.
define <2 x i1> @icmp_sub_neg1_X_ult_4_vec(<2 x i32> %X) {
; CHECK-LABEL: @icmp_sub_neg1_X_ult_4_vec(
; CHECK-NEXT: [[SUB:%.*]] = xor <2 x i32> %X, <i32 -1, i32 -1>
; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i32> [[SUB]], <i32 4, i32 4>
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%sub = sub <2 x i32> <i32 -1, i32 -1>, %X
%cmp = icmp ult <2 x i32> %sub, <i32 4, i32 4>
ret <2 x i1> %cmp
}
define i1 @icmp_sub_-1_X_uge_4(i32 %X) {
; CHECK-LABEL: @icmp_sub_-1_X_uge_4(
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 %X, -4
@ -1556,6 +1568,18 @@ define i1 @icmp_sub_-1_X_uge_4(i32 %X) {
ret i1 %cmp
}
; FIXME: Vectors should fold too.
define <2 x i1> @icmp_sub_neg1_X_uge_4_vec(<2 x i32> %X) {
; CHECK-LABEL: @icmp_sub_neg1_X_uge_4_vec(
; CHECK-NEXT: [[SUB:%.*]] = xor <2 x i32> %X, <i32 -1, i32 -1>
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[SUB]], <i32 3, i32 3>
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%sub = sub <2 x i32> <i32 -1, i32 -1>, %X
%cmp = icmp uge <2 x i32> %sub, <i32 4, i32 4>
ret <2 x i1> %cmp
}
define i1 @icmp_swap_operands_for_cse(i32 %X, i32 %Y) {
; CHECK-LABEL: @icmp_swap_operands_for_cse(
; CHECK-NEXT: entry:

View File

@ -12,6 +12,18 @@ define i1 @test0(i32 %A) {
ret i1 %C
}
; FIXME: Vectors should fold too.
define <2 x i1> @test0vec(<2 x i32> %A) {
; CHECK-LABEL: @test0vec(
; CHECK-NEXT: [[B:%.*]] = xor <2 x i32> %A, <i32 -2147483648, i32 -2147483648>
; CHECK-NEXT: [[C:%.*]] = icmp sgt <2 x i32> [[B]], <i32 -1, i32 -1>
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%B = xor <2 x i32> %A, <i32 -2147483648, i32 -2147483648>
%C = icmp sgt <2 x i32> %B, <i32 -1, i32 -1>
ret <2 x i1> %C
}
define i1 @test1(i32 %A) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[C:%.*]] = icmp slt i32 %A, 0