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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
      Known to fail|                            |4.7.4

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So after r0-118261 (this just happen to have that side effect but it is a good
side effect that way), uncprop can happen and we can produce:
  _3 = a_2(D) & 8;
  if (_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  _5 = b_4(D) & 4;
  _1 = _5 != 0;
  _6 = (int) _1;

  <bb 4>:
  # prephitmp_8 = PHI <_3(2), _6(3)>

Rather than having _3 in the PHI being 0.
And that is able to remove the extra xor.

As mentioned we should do better here though.
unsigned
f1(unsigned a, unsigned b)
{
  return (((a & 8)>>3) & ((b & 4)>>2));
}
Is the best.

Reply via email to