[llvm] 7007919 - [InstCombine] Add additional test for invert of lshr (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 07:10:09 PST 2023


Author: Nikita Popov
Date: 2023-12-01T16:09:54+01:00
New Revision: 7007919cfde7c7515c0c2cc9b7d66616225d0b17

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

LOG: [InstCombine] Add additional test for invert of lshr (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/free-inversion.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/free-inversion.ll b/llvm/test/Transforms/InstCombine/free-inversion.ll
index c16310cf09631c5..93d293df6048e32 100644
--- a/llvm/test/Transforms/InstCombine/free-inversion.ll
+++ b/llvm/test/Transforms/InstCombine/free-inversion.ll
@@ -524,3 +524,15 @@ define i8 @lshr_not_nneg(i8 %x, i8 %y) {
   %shr.not = xor i8 %shr, -1
   ret i8 %shr.not
 }
+
+define i8 @lshr_not_nneg2(i8 %x) {
+; CHECK-LABEL: @lshr_not_nneg2(
+; CHECK-NEXT:    [[SHR:%.*]] = lshr i8 [[X:%.*]], 1
+; CHECK-NEXT:    [[SHR_NOT1:%.*]] = or i8 [[SHR]], -128
+; CHECK-NEXT:    ret i8 [[SHR_NOT1]]
+;
+  %x.not = xor i8 %x, -1
+  %shr = lshr i8 %x.not, 1
+  %shr.not = xor i8 %shr, -1
+  ret i8 %shr.not
+}


        


More information about the llvm-commits mailing list