[llvm] r369163 - [InstCombine][NFC] Revisit tests in reuse-constant-from-select-in-icmp.ll

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 15:40:06 PDT 2019


Author: lebedevri
Date: Fri Aug 16 15:40:06 2019
New Revision: 369163

URL: http://llvm.org/viewvc/llvm-project?rev=369163&view=rev
Log:
[InstCombine][NFC] Revisit tests in reuse-constant-from-select-in-icmp.ll

Modified:
    llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll

Modified: llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll?rev=369163&r1=369162&r2=369163&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll Fri Aug 16 15:40:06 2019
@@ -211,41 +211,41 @@ define i32 @p15_commutativity2(i32 %x, i
 define <2 x i32> @n17_ult_zero(<2 x i32> %x, <2 x i32> %y) {
 ; CHECK-LABEL: @n17_ult_zero(
 ; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> [[X:%.*]], <i32 65536, i32 0>
-; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 65535>
+; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 -1>
 ; CHECK-NEXT:    ret <2 x i32> [[R]]
 ;
   %t = icmp ult <2 x i32> %x, <i32 65536, i32 0>
-  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 65535>
+  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 -1>
   ret <2 x i32> %r
 }
 define <2 x i32> @n18_ugt_allones(<2 x i32> %x, <2 x i32> %y) {
 ; CHECK-LABEL: @n18_ugt_allones(
 ; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> [[X:%.*]], <i32 65534, i32 -1>
-; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 65535>
+; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 0>
 ; CHECK-NEXT:    ret <2 x i32> [[R]]
 ;
   %t = icmp ugt <2 x i32> %x, <i32 65534, i32 -1>
-  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 65535>
+  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 0>
   ret <2 x i32> %r
 }
 define <2 x i32> @n19_slt_int_min(<2 x i32> %x, <2 x i32> %y) {
 ; CHECK-LABEL: @n19_slt_int_min(
 ; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> [[X:%.*]], <i32 65536, i32 -2147483648>
-; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 65535>
+; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 2147483647>
 ; CHECK-NEXT:    ret <2 x i32> [[R]]
 ;
   %t = icmp slt <2 x i32> %x, <i32 65536, i32 -2147483648>
-  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 65535>
+  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 2147483647>
   ret <2 x i32> %r
 }
 define <2 x i32> @n20_sgt_int_max(<2 x i32> %x, <2 x i32> %y) {
 ; CHECK-LABEL: @n20_sgt_int_max(
 ; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> [[X:%.*]], <i32 65534, i32 2147483647>
-; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 65535>
+; CHECK-NEXT:    [[R:%.*]] = select <2 x i1> [[T]], <2 x i32> [[Y:%.*]], <2 x i32> <i32 65535, i32 -2147483648>
 ; CHECK-NEXT:    ret <2 x i32> [[R]]
 ;
   %t = icmp sgt <2 x i32> %x, <i32 65534, i32 2147483647>
-  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 65535>
+  %r = select <2 x i1> %t, <2 x i32> %y, <2 x i32> <i32 65535, i32 -2147483648>
   ret <2 x i32> %r
 }
 
@@ -296,3 +296,25 @@ define i32 @n24_ult_65534(i32 %x, i32 %y
   %r = select i1 %t, i32 %y, i32 65535
   ret i32 %r
 }
+
+; If we already have a match, it's good enough.
+define i32 @n25_all_good0(i32 %x, i32 %y) {
+; CHECK-LABEL: @n25_all_good0(
+; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 [[X:%.*]], 65536
+; CHECK-NEXT:    [[R:%.*]] = select i1 [[T]], i32 65535, i32 65536
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %t = icmp ult i32 %x, 65536
+  %r = select i1 %t, i32 65535, i32 65536
+  ret i32 %r
+}
+define i32 @n26_all_good1(i32 %x, i32 %y) {
+; CHECK-LABEL: @n26_all_good1(
+; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 [[X:%.*]], 65536
+; CHECK-NEXT:    [[R:%.*]] = select i1 [[T]], i32 65536, i32 65535
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %t = icmp ult i32 %x, 65536
+  %r = select i1 %t, i32 65536, i32 65535
+  ret i32 %r
+}




More information about the llvm-commits mailing list