[Bug tree-optimization/56711] missed optimization for __uint128_t of (unsigned long long)x != x

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 24 17:23:00 GMT 2013


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-linux-gnu
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2013-03-24
          Component|rtl-optimization            |tree-optimization
     Ever Confirmed|0                           |1
            Summary|spectaculary bad code       |missed optimization for
                   |generated for __uint128_t   |__uint128_t of (unsigned
                   |                            |long long)x != x
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-24 17:22:57 UTC ---
>The code gcc generates is 92 bytes long, the one from clang only 65. 

If you are going to compare GCC to clang with respect of code size then you
should analyze the code at least.  It is very obvious what GCC is not doing.

Well looking at the generated code GCC does not optimize:
    if ((unsigned long)x != x) break;

Into just:
x>>64 == 0

An another example is:
int f(unsigned a)
{
  return (unsigned short)a != a;
}

int g(unsigned a)
{
  return a>>16 == 0;
}



More information about the Gcc-bugs mailing list