[Bug rtl-optimization/67413] New: Complex NOP expanded to several operations

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 31 14:43:00 GMT 2015


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

            Bug ID: 67413
           Summary: Complex NOP expanded to several operations
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---

_Complex unsigned f(_Complex int i){return i;}

yields

        movl    %edi, %eax
        shrq    $32, %rdi
        salq    $32, %rdi
        orq     %rdi, %rax
        ret

I read somewhere that complex integers are a deprecated gcc extension, but gcc
only warns in pedantic mode, and it should not be too hard to improve the
generated code.

Note that tree optimizers currently also fail to optimize the corresponding
code:

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

(using & CST instead of >> and << does not help)



More information about the Gcc-bugs mailing list