https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85234

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|missed optimisation         |missed optimisation
                   |opportunity for (~x >>      |opportunity for (x >>
                   |CST)!=0 is not optimized to |CST)!=0 is not optimized to
                   |  (((unsigned)x) <          |  (((unsigned)x) >=
                   |~((1<<CST) - 1))            |(1<<CST)

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The general thing is:
  _2 = a >> 3;
  if (_2 != 0)

Should be optimized to just:
((unsigned)a) >= (1<<3)
Which is the same as:
((unsigned)a) > ((1<<3) - 1)

And then
~x > ((1<<3) - 1)

gets (already) optimized to:
x.0_1 <= -9

PR 110010 is related because instead of a 0, we have a similar shift.

Reply via email to