This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/47521] New: Unnecessary usage of edx register


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

           Summary: Unnecessary usage of edx register
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tony.poppleton@gmail.com


In testing PR46235 I noticed some minor inefficiency in the usage of an extra
register.

The C code is:

int foo(int a, int x, int y)
{
   if  (a & (16))
       return a;
   return 1;
}

Which produces the asm:
        movl    %edi, %eax
        movl    $1, %edx
        testb   $16, %al
        cmove   %edx, %eax
        ret

The above code could have been further optimized to remove the usage of edx:
        movl    $1, %eax
        test    $16, %edi
        cmove   %edi, %eax
        ret


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]