[llvm] [InstCombine]: Handle known negative variables with KnownBits (PR #89682)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 15:55:39 PDT 2024


================
@@ -98,6 +98,18 @@ define i8 @udiv_demanded_low_bits_set(i8 %a) {
   ret i8 %u
 }
 
+define i8 @udiv_large_value(i8 %a) {
+; CHECK-LABEL: @udiv_large_value(
+; CHECK-NEXT:    [[TMP1:%.*]] = and i8 [[A:%.*]], -76
+; CHECK-NEXT:    [[TMP2:%.*]] = icmp eq i8 [[TMP1]], -76
+; CHECK-NEXT:    [[U:%.*]] = zext i1 [[TMP2]] to i8
+; CHECK-NEXT:    ret i8 [[U]]
+;
+  %o = or i8 %a, 180
----------------
goldsteinn wrote:

imo make the constant `128` so the verification of this transform is the most general case.

https://github.com/llvm/llvm-project/pull/89682


More information about the llvm-commits mailing list