[llvm] [InstCombine] Handle `ICMP_EQ` when flooring by constant two (PR #73706)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 00:47:51 PST 2023
================
@@ -2700,6 +2700,19 @@ define i32 @floor_sdiv(i32 %x) {
ret i32 %r
}
+define i8 @floor_sdiv_by_2(i8 %x) {
+; CHECK-LABEL: @floor_sdiv_by_2(
+; CHECK-NEXT: [[RV:%.*]] = ashr i8 [[X:%.*]], 1
+; CHECK-NEXT: ret i8 [[RV]]
+;
+ %div = sdiv i8 %x, 2
+ %and = and i8 %x, -127
+ %icmp = icmp eq i8 %and, -127
----------------
nikic wrote:
Please add a negative test with a different constant.
https://github.com/llvm/llvm-project/pull/73706
More information about the llvm-commits
mailing list