http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48812

--- Comment #2 from Matthieu CASTET <castet.matthieu at free dot fr> 2011-04-29 
19:18:43 UTC ---
> We also have to make sure the shift count does not get negative, which
we can't in this case.  Thus (1U<<(b-2)) is not equivalent to
(1U<<b) / 4.

yes, but 
a / c is undefined for c = 0
if c = (1U<<b) / 4 is not 0, then (1U<<b) / 4 is equivalent to (1U<<(b-2))
Then a / ((1U<<b) / 4) is equivalent to a / (1U<<(b-2))
Then a / ((1U<<b) / 4) is equivalent to (a >> (b-2))

But I agree it is not trivial optimisation

Reply via email to