1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[InstCombine] add tests to show type limitations of InsertRangeTest and callers

llvm-svn: 280175
This commit is contained in:
Sanjay Patel 2016-08-30 23:16:59 +00:00
parent ee70f4de4f
commit 0b7546dcd3
3 changed files with 56 additions and 3 deletions

View File

@ -255,11 +255,24 @@ define i1 @test23(i32 %A) {
;
%B = icmp sgt i32 %A, 1
%C = icmp sle i32 %A, 2
;; A == 2
%D = and i1 %B, %C
ret i1 %D
}
; FIXME: Vectors should fold too.
define <2 x i1> @test23vec(<2 x i32> %A) {
; CHECK-LABEL: @test23vec(
; CHECK-NEXT: [[B:%.*]] = icmp sgt <2 x i32> %A, <i32 1, i32 1>
; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> %A, <i32 3, i32 3>
; CHECK-NEXT: [[D:%.*]] = and <2 x i1> [[B]], [[C]]
; CHECK-NEXT: ret <2 x i1> [[D]]
;
%B = icmp sgt <2 x i32> %A, <i32 1, i32 1>
%C = icmp sle <2 x i32> %A, <i32 2, i32 2>
%D = and <2 x i1> %B, %C
ret <2 x i1> %D
}
define i1 @test24(i32 %A) {
; CHECK-LABEL: @test24(
; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i32 %A, 2
@ -280,11 +293,24 @@ define i1 @test25(i32 %A) {
;
%B = icmp sge i32 %A, 50
%C = icmp slt i32 %A, 100
;; (A-50) <u 50
%D = and i1 %B, %C
ret i1 %D
}
; FIXME: Vectors should fold too.
define <2 x i1> @test25vec(<2 x i32> %A) {
; CHECK-LABEL: @test25vec(
; CHECK-NEXT: [[B:%.*]] = icmp sgt <2 x i32> %A, <i32 49, i32 49>
; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> %A, <i32 100, i32 100>
; CHECK-NEXT: [[D:%.*]] = and <2 x i1> [[B]], [[C]]
; CHECK-NEXT: ret <2 x i1> [[D]]
;
%B = icmp sge <2 x i32> %A, <i32 50, i32 50>
%C = icmp slt <2 x i32> %A, <i32 100, i32 100>
%D = and <2 x i1> %B, %C
ret <2 x i1> %D
}
define i1 @test26(i32 %A) {
; CHECK-LABEL: @test26(
; CHECK-NEXT: [[A_OFF:%.*]] = add i32 %A, -49

View File

@ -85,6 +85,20 @@ define i1 @test8(i32 %i) {
ret i1 %cond
}
; FIXME: Vectors should fold too.
define <2 x i1> @test8vec(<2 x i32> %i) {
; CHECK-LABEL: @test8vec(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> %i, zeroinitializer
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult <2 x i32> %i, <i32 14, i32 14>
; CHECK-NEXT: [[COND:%.*]] = and <2 x i1> [[CMP1]], [[CMP2]]
; CHECK-NEXT: ret <2 x i1> [[COND]]
;
%cmp1 = icmp ne <2 x i32> %i, zeroinitializer
%cmp2 = icmp ult <2 x i32> %i, <i32 14, i32 14>
%cond = and <2 x i1> %cmp1, %cmp2
ret <2 x i1> %cond
}
; combine -x & 1 into x & 1
define i64 @test9(i64 %x) {
; CHECK-LABEL: @test9(

View File

@ -189,11 +189,24 @@ define i1 @test18(i32 %A) {
;
%B = icmp sge i32 %A, 100
%C = icmp slt i32 %A, 50
;; (A-50) >u 50
%D = or i1 %B, %C
ret i1 %D
}
; FIXME: Vectors should fold too.
define <2 x i1> @test18vec(<2 x i32> %A) {
; CHECK-LABEL: @test18vec(
; CHECK-NEXT: [[B:%.*]] = icmp sgt <2 x i32> %A, <i32 99, i32 99>
; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> %A, <i32 50, i32 50>
; CHECK-NEXT: [[D:%.*]] = or <2 x i1> [[B]], [[C]]
; CHECK-NEXT: ret <2 x i1> [[D]]
;
%B = icmp sge <2 x i32> %A, <i32 100, i32 100>
%C = icmp slt <2 x i32> %A, <i32 50, i32 50>
%D = or <2 x i1> %B, %C
ret <2 x i1> %D
}
define i1 @test19(i32 %A) {
; CHECK-LABEL: @test19(
; CHECK-NEXT: [[TMP1:%.*]] = or i32 %A, 1