[llvm] 835fd06 - [InstCombine] add test for possible sub->xor fold; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 09:38:05 PDT 2022


Author: Sanjay Patel
Date: 2022-07-11T12:37:35-04:00
New Revision: 835fd0679a14193c82c49b55297fdc049c05fa5a

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

LOG: [InstCombine] add test for possible sub->xor fold; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/sub-xor.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/sub-xor.ll b/llvm/test/Transforms/InstCombine/sub-xor.ll
index f47bc2fdae7e9..45aabb99630bf 100644
--- a/llvm/test/Transforms/InstCombine/sub-xor.ll
+++ b/llvm/test/Transforms/InstCombine/sub-xor.ll
@@ -36,6 +36,19 @@ define i8 @masked_sub_i8(i8 %x) {
   ret i8 %m
 }
 
+; TODO: Borrow from the MSB is ok.
+
+define i8 @masked_sub_high_bit_mask_i8(i8 %x) {
+; CHECK-LABEL: @masked_sub_high_bit_mask_i8(
+; CHECK-NEXT:    [[MASKX:%.*]] = and i8 [[X:%.*]], -93
+; CHECK-NEXT:    [[S:%.*]] = sub i8 39, [[MASKX]]
+; CHECK-NEXT:    ret i8 [[S]]
+;
+  %maskx = and i8 %x, 163 ; 0b10100011
+  %s = sub i8 39, %maskx  ; 0b00100111
+  ret i8 %s
+}
+
 define <2 x i5> @masked_sub_v2i5(<2 x i5> %x) {
 ; CHECK-LABEL: @masked_sub_v2i5(
 ; CHECK-NEXT:    [[A:%.*]] = and <2 x i5> [[X:%.*]], <i5 -8, i5 -8>


        


More information about the llvm-commits mailing list