[llvm] d1511ed - [InstCombine] adjust/add tests for cmp-of-signbits; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 05:47:47 PST 2023


Author: Sanjay Patel
Date: 2023-01-24T08:47:40-05:00
New Revision: d1511ed8d19acba069b5ba306960a49d99c0f047

URL: https://github.com/llvm/llvm-project/commit/d1511ed8d19acba069b5ba306960a49d99c0f047
DIFF: https://github.com/llvm/llvm-project/commit/d1511ed8d19acba069b5ba306960a49d99c0f047.diff

LOG: [InstCombine] adjust/add tests for cmp-of-signbits; NFC

These were added with e76c95fb40b1081438 with the
right test names, but the predicates weren't updated
to match.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp-shr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-shr.ll b/llvm/test/Transforms/InstCombine/icmp-shr.ll
index 340568bafa8ef..2b775bd365270 100644
--- a/llvm/test/Transforms/InstCombine/icmp-shr.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-shr.ll
@@ -1337,13 +1337,13 @@ define <2 x i1> @same_signbit(<2 x i8> %x, <2 x i8> %y) {
 ; CHECK-NEXT:    [[XSIGN:%.*]] = lshr <2 x i8> [[X:%.*]], <i8 7, i8 7>
 ; CHECK-NEXT:    [[YPOS:%.*]] = icmp sgt <2 x i8> [[Y:%.*]], <i8 -1, i8 -1>
 ; CHECK-NEXT:    [[YPOSZ:%.*]] = zext <2 x i1> [[YPOS]] to <2 x i8>
-; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i8> [[XSIGN]], [[YPOSZ]]
+; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i8> [[XSIGN]], [[YPOSZ]]
 ; CHECK-NEXT:    ret <2 x i1> [[R]]
 ;
   %xsign = lshr <2 x i8> %x, <i8 7, i8 7>
   %ypos = icmp sgt <2 x i8> %y, <i8 -1, i8 -1>
   %yposz = zext <2 x i1> %ypos to <2 x i8>
-  %r = icmp eq <2 x i8> %xsign, %yposz
+  %r = icmp ne <2 x i8> %xsign, %yposz
   ret <2 x i1> %r
 }
 
@@ -1353,14 +1353,14 @@ define i1 @same_signbit_use2(i8 %x, i8 %y) {
 ; CHECK-NEXT:    [[YPOS:%.*]] = icmp sgt i8 [[Y:%.*]], -1
 ; CHECK-NEXT:    [[YPOSZ:%.*]] = zext i1 [[YPOS]] to i8
 ; CHECK-NEXT:    call void @use(i8 [[YPOSZ]])
-; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[XSIGN]], [[YPOSZ]]
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i8 [[XSIGN]], [[YPOSZ]]
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %xsign = lshr i8 %x, 7
   %ypos = icmp sgt i8 %y, -1
   %yposz = zext i1 %ypos to i8
   call void @use(i8 %yposz)
-  %r = icmp eq i8 %xsign, %yposz
+  %r = icmp ne i8 %xsign, %yposz
   ret i1 %r
 }
 
@@ -1371,7 +1371,7 @@ define i1 @same_signbit_use3(i8 %x, i8 %y) {
 ; CHECK-NEXT:    [[YPOS:%.*]] = icmp sgt i8 [[Y:%.*]], -1
 ; CHECK-NEXT:    [[YPOSZ:%.*]] = zext i1 [[YPOS]] to i8
 ; CHECK-NEXT:    call void @use(i8 [[YPOSZ]])
-; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[XSIGN]], [[YPOSZ]]
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i8 [[XSIGN]], [[YPOSZ]]
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %xsign = lshr i8 %x, 7
@@ -1379,10 +1379,39 @@ define i1 @same_signbit_use3(i8 %x, i8 %y) {
   %ypos = icmp sgt i8 %y, -1
   %yposz = zext i1 %ypos to i8
   call void @use(i8 %yposz)
-  %r = icmp eq i8 %xsign, %yposz
+  %r = icmp ne i8 %xsign, %yposz
   ret i1 %r
 }
 
+define <2 x i1> @same_signbit_poison_elts(<2 x i8> %x, <2 x i8> %y) {
+; CHECK-LABEL: @same_signbit_poison_elts(
+; CHECK-NEXT:    [[XSIGN:%.*]] = lshr <2 x i8> [[X:%.*]], <i8 7, i8 poison>
+; CHECK-NEXT:    [[YPOS:%.*]] = icmp sgt <2 x i8> [[Y:%.*]], <i8 -1, i8 poison>
+; CHECK-NEXT:    [[YPOSZ:%.*]] = zext <2 x i1> [[YPOS]] to <2 x i8>
+; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i8> [[XSIGN]], [[YPOSZ]]
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %xsign = lshr <2 x i8> %x, <i8 7, i8 poison>
+  %ypos = icmp sgt <2 x i8> %y, <i8 -1, i8 poison>
+  %yposz = zext <2 x i1> %ypos to <2 x i8>
+  %r = icmp ne <2 x i8> %xsign, %yposz
+  ret <2 x i1> %r
+}
+
+define i1 @same_signbit_wrong_type(i8 %x, i32 %y) {
+; CHECK-LABEL: @same_signbit_wrong_type(
+; CHECK-NEXT:    [[XSIGN:%.*]] = lshr i8 [[X:%.*]], 7
+; CHECK-NEXT:    [[YPOS:%.*]] = icmp sgt i32 [[Y:%.*]], -1
+; CHECK-NEXT:    [[YPOSZ:%.*]] = zext i1 [[YPOS]] to i8
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i8 [[XSIGN]], [[YPOSZ]]
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %xsign = lshr i8 %x, 7
+  %ypos = icmp sgt i32 %y, -1
+  %yposz = zext i1 %ypos to i8
+  %r = icmp ne i8 %xsign, %yposz
+  ret i1 %r
+}
 define i1 @exactly_one_set_signbit_wrong_shamt(i8 %x, i8 %y) {
 ; CHECK-LABEL: @exactly_one_set_signbit_wrong_shamt(
 ; CHECK-NEXT:    [[XSIGN:%.*]] = lshr i8 [[X:%.*]], 6


        


More information about the llvm-commits mailing list