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

           Summary: Piecewise complex pass-through not optimized
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org


Neither

_Complex float 
foo (_Complex float x)
{    
  float r = __real x;
  float i = __imag x;
  _Complex float z;
  __real z = r;
  __imag z = i;
  return z;
} 

nor

_Complex float 
foo (_Complex float x)
{    
  float r = __real x;
  float i = __imag x;
  _Complex float z = x;
  __real z = r;
  __imag z = i;
  return z;
} 

are optimized to just return x.  In the former case we have uninitialized
uses of z in the IL while in the latter case not.

_Complex float 
foo (_Complex float x)
{    
  float r = __real x;
  float i = __imag x;
  return  r + 1.0iF * i;
} 

with -ffast-math is also not optimized.  Nor is

_Complex float 
foo (_Complex float x)
{    
  return  __real x + 1.0iF * __imag x;
} 

but I have a patch for that ;)

Reply via email to