[llvm] r286256 - [InstCombine] move min/max tests to min/max test file; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 10:12:20 PST 2016


Author: spatel
Date: Tue Nov  8 12:12:19 2016
New Revision: 286256

URL: http://llvm.org/viewvc/llvm-project?rev=286256&view=rev
Log:
[InstCombine] move min/max tests to min/max test file; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll
    llvm/trunk/test/Transforms/InstCombine/select.ll

Modified: llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll?rev=286256&r1=286255&r2=286256&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll Tue Nov  8 12:12:19 2016
@@ -197,3 +197,145 @@ define <4 x float> @bitcasts_icmp(<2 x i
   ret <4 x float> %t5
 }
 
+; SMIN(SMIN(X, 11), 92) -> SMIN(X, 11)
+define i32 @test68(i32 %x) {
+; CHECK-LABEL: @test68(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 11
+; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 11, i32 %x
+; CHECK-NEXT:    ret i32 [[COND]]
+;
+  %cmp = icmp slt i32 11, %x
+  %cond = select i1 %cmp, i32 11, i32 %x
+  %cmp3 = icmp slt i32 92, %cond
+  %retval = select i1 %cmp3, i32 92, i32 %cond
+  ret i32 %retval
+}
+
+define <2 x i32> @test68vec(<2 x i32> %x) {
+; CHECK-LABEL: @test68vec(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11>
+; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x
+; CHECK-NEXT:    ret <2 x i32> [[COND]]
+;
+  %cmp = icmp slt <2 x i32> <i32 11, i32 11>, %x
+  %cond = select <2 x i1> %cmp, <2 x i32> <i32 11, i32 11>, <2 x i32> %x
+  %cmp3 = icmp slt <2 x i32> <i32 92, i32 92>, %cond
+  %retval = select <2 x i1> %cmp3, <2 x i32> <i32 92, i32 92>, <2 x i32> %cond
+  ret <2 x i32> %retval
+}
+
+; MIN(MIN(X, 24), 83) -> MIN(X, 24)
+define i32 @test69(i32 %x) {
+; CHECK-LABEL: @test69(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i32 %x, 24
+; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 24, i32 %x
+; CHECK-NEXT:    ret i32 [[COND]]
+;
+  %cmp = icmp ult i32 24, %x
+  %cond = select i1 %cmp, i32 24, i32 %x
+  %cmp3 = icmp ult i32 83, %cond
+  %retval = select i1 %cmp3, i32 83, i32 %cond
+  ret i32 %retval
+}
+
+; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)
+define i32 @test70(i32 %x) {
+; CHECK-LABEL: @test70(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75
+; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x
+; CHECK-NEXT:    ret i32 [[COND]]
+;
+  %cmp = icmp slt i32 %x, 75
+  %cond = select i1 %cmp, i32 75, i32 %x
+  %cmp3 = icmp slt i32 %cond, 36
+  %retval = select i1 %cmp3, i32 36, i32 %cond
+  ret i32 %retval
+}
+
+; MAX(MAX(X, 68), 47) -> MAX(X, 68)
+define i32 @test71(i32 %x) {
+; CHECK-LABEL: @test71(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 %x, 68
+; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 68, i32 %x
+; CHECK-NEXT:    ret i32 [[COND]]
+;
+  %cmp = icmp ult i32 %x, 68
+  %cond = select i1 %cmp, i32 68, i32 %x
+  %cmp3 = icmp ult i32 %cond, 47
+  %retval = select i1 %cmp3, i32 47, i32 %cond
+  ret i32 %retval
+}
+
+; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)
+define i32 @test72(i32 %x) {
+; CHECK-LABEL: @test72(
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x
+; CHECK-NEXT:    ret i32 [[RETVAL]]
+;
+  %cmp = icmp sgt i32 %x, 92
+  %cond = select i1 %cmp, i32 92, i32 %x
+  %cmp3 = icmp sgt i32 %cond, 11
+  %retval = select i1 %cmp3, i32 11, i32 %cond
+  ret i32 %retval
+}
+
+; FIXME - vector neglect: FoldOrOfICmps()
+
+define <2 x i32> @test72vec(<2 x i32> %x) {
+; CHECK-LABEL: @test72vec(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 92, i32 92>
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11>
+; CHECK-NEXT:    [[CMP3:%.*]] = or <2 x i1> [[CMP]], [[CMP31:%.*]]
+; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[CMP3]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x
+; CHECK-NEXT:    ret <2 x i32> [[RETVAL]]
+;
+  %cmp = icmp sgt <2 x i32> %x, <i32 92, i32 92>
+  %cond = select <2 x i1> %cmp, <2 x i32> <i32 92, i32 92>, <2 x i32> %x
+  %cmp3 = icmp sgt <2 x i32> %cond, <i32 11, i32 11>
+  %retval = select <2 x i1> %cmp3, <2 x i32> <i32 11, i32 11>, <2 x i32> %cond
+  ret <2 x i32> %retval
+}
+
+; MIN(MIN(X, 83), 24) -> MIN(X, 24)
+define i32 @test73(i32 %x) {
+; CHECK-LABEL: @test73(
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp ugt i32 %x, 24
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 24, i32 %x
+; CHECK-NEXT:    ret i32 [[RETVAL]]
+;
+  %cmp = icmp ugt i32 %x, 83
+  %cond = select i1 %cmp, i32 83, i32 %x
+  %cmp3 = icmp ugt i32 %cond, 24
+  %retval = select i1 %cmp3, i32 24, i32 %cond
+  ret i32 %retval
+}
+
+; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)
+define i32 @test74(i32 %x) {
+; CHECK-LABEL: @test74(
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x
+; CHECK-NEXT:    ret i32 [[RETVAL]]
+;
+  %cmp = icmp slt i32 %x, 36
+  %cond = select i1 %cmp, i32 36, i32 %x
+  %cmp3 = icmp slt i32 %cond, 75
+  %retval = select i1 %cmp3, i32 75, i32 %cond
+  ret i32 %retval
+}
+
+; MAX(MAX(X, 47), 68) -> MAX(X, 68)
+define i32 @test75(i32 %x) {
+; CHECK-LABEL: @test75(
+; CHECK-NEXT:    [[CMP31:%.*]] = icmp ult i32 %x, 68
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 68, i32 %x
+; CHECK-NEXT:    ret i32 [[RETVAL]]
+;
+  %cmp = icmp ult i32 %x, 47
+  %cond = select i1 %cmp, i32 47, i32 %x
+  %cmp3 = icmp ult i32 %cond, 68
+  %retval = select i1 %cmp3, i32 68, i32 %cond
+  ret i32 %retval
+}
+

Modified: llvm/trunk/test/Transforms/InstCombine/select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=286256&r1=286255&r2=286256&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/select.ll Tue Nov  8 12:12:19 2016
@@ -1181,148 +1181,6 @@ define i32 @test67(i16 %x) {
 ; CHECK: xor i32 %3, 42
 }
 
-; SMIN(SMIN(X, 11), 92) -> SMIN(X, 11)
-define i32 @test68(i32 %x) {
-; CHECK-LABEL: @test68(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 11
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 11, i32 %x
-; CHECK-NEXT:    ret i32 [[COND]]
-;
-  %cmp = icmp slt i32 11, %x
-  %cond = select i1 %cmp, i32 11, i32 %x
-  %cmp3 = icmp slt i32 92, %cond
-  %retval = select i1 %cmp3, i32 92, i32 %cond
-  ret i32 %retval
-}
-
-define <2 x i32> @test68vec(<2 x i32> %x) {
-; CHECK-LABEL: @test68vec(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11>
-; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x
-; CHECK-NEXT:    ret <2 x i32> [[COND]]
-;
-  %cmp = icmp slt <2 x i32> <i32 11, i32 11>, %x
-  %cond = select <2 x i1> %cmp, <2 x i32> <i32 11, i32 11>, <2 x i32> %x
-  %cmp3 = icmp slt <2 x i32> <i32 92, i32 92>, %cond
-  %retval = select <2 x i1> %cmp3, <2 x i32> <i32 92, i32 92>, <2 x i32> %cond
-  ret <2 x i32> %retval
-}
-
-; MIN(MIN(X, 24), 83) -> MIN(X, 24)
-define i32 @test69(i32 %x) {
-; CHECK-LABEL: @test69(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i32 %x, 24
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 24, i32 %x
-; CHECK-NEXT:    ret i32 [[COND]]
-;
-  %cmp = icmp ult i32 24, %x
-  %cond = select i1 %cmp, i32 24, i32 %x
-  %cmp3 = icmp ult i32 83, %cond
-  %retval = select i1 %cmp3, i32 83, i32 %cond
-  ret i32 %retval
-}
-
-; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)
-define i32 @test70(i32 %x) {
-; CHECK-LABEL: @test70(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x
-; CHECK-NEXT:    ret i32 [[COND]]
-;
-  %cmp = icmp slt i32 %x, 75
-  %cond = select i1 %cmp, i32 75, i32 %x
-  %cmp3 = icmp slt i32 %cond, 36
-  %retval = select i1 %cmp3, i32 36, i32 %cond
-  ret i32 %retval
-}
-
-; MAX(MAX(X, 68), 47) -> MAX(X, 68)
-define i32 @test71(i32 %x) {
-; CHECK-LABEL: @test71(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 %x, 68
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 68, i32 %x
-; CHECK-NEXT:    ret i32 [[COND]]
-;
-  %cmp = icmp ult i32 %x, 68
-  %cond = select i1 %cmp, i32 68, i32 %x
-  %cmp3 = icmp ult i32 %cond, 47
-  %retval = select i1 %cmp3, i32 47, i32 %cond
-  ret i32 %retval
-}
-
-; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)
-define i32 @test72(i32 %x) {
-; CHECK-LABEL: @test72(
-; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x
-; CHECK-NEXT:    ret i32 [[RETVAL]]
-;
-  %cmp = icmp sgt i32 %x, 92
-  %cond = select i1 %cmp, i32 92, i32 %x
-  %cmp3 = icmp sgt i32 %cond, 11
-  %retval = select i1 %cmp3, i32 11, i32 %cond
-  ret i32 %retval
-}
-
-; FIXME - vector neglect: FoldOrOfICmps()
-
-define <2 x i32> @test72vec(<2 x i32> %x) {
-; CHECK-LABEL: @test72vec(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 92, i32 92>
-; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11>
-; CHECK-NEXT:    [[CMP3:%.*]] = or <2 x i1> [[CMP]], [[CMP31:%.*]]
-; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[CMP3]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x
-; CHECK-NEXT:    ret <2 x i32> [[RETVAL]]
-;
-  %cmp = icmp sgt <2 x i32> %x, <i32 92, i32 92>
-  %cond = select <2 x i1> %cmp, <2 x i32> <i32 92, i32 92>, <2 x i32> %x
-  %cmp3 = icmp sgt <2 x i32> %cond, <i32 11, i32 11>
-  %retval = select <2 x i1> %cmp3, <2 x i32> <i32 11, i32 11>, <2 x i32> %cond
-  ret <2 x i32> %retval
-}
-
-; MIN(MIN(X, 83), 24) -> MIN(X, 24)
-define i32 @test73(i32 %x) {
-; CHECK-LABEL: @test73(
-; CHECK-NEXT:    [[CMP31:%.*]] = icmp ugt i32 %x, 24
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 24, i32 %x
-; CHECK-NEXT:    ret i32 [[RETVAL]]
-;
-  %cmp = icmp ugt i32 %x, 83
-  %cond = select i1 %cmp, i32 83, i32 %x
-  %cmp3 = icmp ugt i32 %cond, 24
-  %retval = select i1 %cmp3, i32 24, i32 %cond
-  ret i32 %retval
-}
-
-; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)
-define i32 @test74(i32 %x) {
-; CHECK-LABEL: @test74(
-; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x
-; CHECK-NEXT:    ret i32 [[RETVAL]]
-;
-  %cmp = icmp slt i32 %x, 36
-  %cond = select i1 %cmp, i32 36, i32 %x
-  %cmp3 = icmp slt i32 %cond, 75
-  %retval = select i1 %cmp3, i32 75, i32 %cond
-  ret i32 %retval
-}
-
-; MAX(MAX(X, 47), 68) -> MAX(X, 68)
-define i32 @test75(i32 %x) {
-; CHECK-LABEL: @test75(
-; CHECK-NEXT:    [[CMP31:%.*]] = icmp ult i32 %x, 68
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 68, i32 %x
-; CHECK-NEXT:    ret i32 [[RETVAL]]
-;
-  %cmp = icmp ult i32 %x, 47
-  %cond = select i1 %cmp, i32 47, i32 %x
-  %cmp3 = icmp ult i32 %cond, 68
-  %retval = select i1 %cmp3, i32 68, i32 %cond
-  ret i32 %retval
-}
-
 @under_aligned = external global i32, align 1
 
 define i32 @test76(i1 %flag, i32* %x) {




More information about the llvm-commits mailing list