Closed
Description
From rust-lang/rust#118392, we're missing this transform: https://alive2.llvm.org/ce/z/8-eUdb
define i8 @src(i8 %a) {
%q.i = sdiv i8 %a, 2
%1 = and i8 %a, -127
%_8.i = icmp eq i8 %1, -127
%2 = sext i1 %_8.i to i8
%_0.0.i = add nsw i8 %q.i, %2
ret i8 %_0.0.i
}
define i8 @tgt(i8 %a) {
%_0 = ashr i8 %a, 1
ret i8 %_0
}
Worth noting that this already works for other power of two constants, such as div_euclid(4)
, so we probably already have a transform for this, but additional canonicalizations for 2 in particular get in the way.