[llvm] r280175 - [InstCombine] add tests to show type limitations of InsertRangeTest and callers
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 16:17:00 PDT 2016
Author: spatel
Date: Tue Aug 30 18:16:59 2016
New Revision: 280175
URL: http://llvm.org/viewvc/llvm-project?rev=280175&view=rev
Log:
[InstCombine] add tests to show type limitations of InsertRangeTest and callers
Modified:
llvm/trunk/test/Transforms/InstCombine/and.ll
llvm/trunk/test/Transforms/InstCombine/and2.ll
llvm/trunk/test/Transforms/InstCombine/or.ll
Modified: llvm/trunk/test/Transforms/InstCombine/and.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and.ll?rev=280175&r1=280174&r2=280175&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and.ll Tue Aug 30 18:16:59 2016
@@ -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
Modified: llvm/trunk/test/Transforms/InstCombine/and2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and2.ll?rev=280175&r1=280174&r2=280175&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and2.ll Tue Aug 30 18:16:59 2016
@@ -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(
Modified: llvm/trunk/test/Transforms/InstCombine/or.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/or.ll?rev=280175&r1=280174&r2=280175&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/or.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/or.ll Tue Aug 30 18:16:59 2016
@@ -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
More information about the llvm-commits
mailing list