[llvm] 00cb1c3 - [InstCombine] add negtive tests for (%x & C) == 0 -> %x u< (-C). nfc

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 01:49:57 PDT 2022


Author: Chenbing Zheng
Date: 2022-07-05T16:49:20+08:00
New Revision: 00cb1c33ee2e8bb8b75f5e45c0bf671ed65208e6

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

LOG: [InstCombine] add negtive tests for (%x & C) == 0 -> %x u< (-C). nfc

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll b/llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
index 0ac3b19787e1..0b4d6c7f0781 100644
--- a/llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
+++ b/llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
@@ -234,3 +234,18 @@ define i1 @scalar_i32_lshr_and_negC_eq_nonzero(i32 %x, i32 %y) {
   %r = icmp eq i32 %and, 1  ; should be comparing with 0
   ret i1 %r
 }
+
+; Not NegatedPowerOf2
+
+define i1 @scalar_i8_lshr_and_negC_eq_not_negatedPowerOf2(i8 %x, i8 %y) {
+; CHECK-LABEL: @scalar_i8_lshr_and_negC_eq_not_negatedPowerOf2(
+; CHECK-NEXT:    [[TMP1:%.*]] = shl i8 -3, [[Y:%.*]]
+; CHECK-NEXT:    [[TMP2:%.*]] = and i8 [[TMP1]], [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[TMP2]], 0
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %lshr = lshr i8 %x, %y
+  %and = and i8 %lshr, 253  ; -3
+  %r = icmp eq i8 %and, 0
+  ret i1 %r
+}


        


More information about the llvm-commits mailing list