You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a signed integer is divided by a power of two it is not a simple shift like for unsigned because division rounds to zero while the shift would round down. If flooring division is implemented, then flooring division by a power of two is equivalent to an arithmetic shift.
Here, floor_div4_a and floor_div4_b are equivalent, but the code generated for _a is not as good as _c.
It's a bigger match than usual, but I have not found any
sub-patterns that reduce:
(X / DivC) + sext ((X & (SMin | (DivC - 1)) >u SMin) --> X >>s log2(DivC)
https://alive2.llvm.org/ce/z/MJzlhl
Fixes issue #55741
If a signed integer is divided by a power of two it is not a simple shift like for unsigned because division rounds to zero while the shift would round down. If flooring division is implemented, then flooring division by a power of two is equivalent to an arithmetic shift.
Here,
floor_div4_a
andfloor_div4_b
are equivalent, but the code generated for_a
is not as good as_c
.[Compiler explorer]
(This is similar to rustc issue rust-lang/rust#71096.)
The text was updated successfully, but these errors were encountered: