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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |tree-optimization

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
At the tree level we get:
  _1 = REALPART_EXPR <i_5(D)>;
  _2 = (unsigned int) _1;
  _3 = IMAGPART_EXPR <i_5(D)>;
  _4 = (unsigned int) _3;
  _6 = COMPLEX_EXPR <_2, _4>;


But I suspect we could use VCE instead ...


> long f(long x){
>   long y = x >> 32;
>   y <<= 32;
>   int z = x;
>   return z | y;
> }

You have a sign extend in there.  That is the top bit of z (or the 32nd bit of
x) could done for the top 32bits of the return.  So this is not exactly the
same.
We do however optimize:
unsigned long f(unsigned long x){
  long y = x >> 32;
  y <<= 32;
  unsigned z = x;
  return z | y;
}

Now.

Reply via email to