[Bug target/55147] New: x86: wrong code for 64-bit load

mans at mansr dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 31 11:23:00 GMT 2012


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

             Bug #: 55147
           Summary: x86: wrong code for 64-bit load
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mans@mansr.com


> cat foo.c
unsigned foo(unsigned long long *p, int i)
{
    return __builtin_bswap64(p[i]);
}

> gcc-4.8.0 -m32 -O1 -S foo.c
foo:
        movl    8(%esp), %edx
        movl    4(%esp), %eax
        movl    (%eax,%edx,8), %edx
        movl    4(%eax,%edx,8), %eax
        bswap   %eax
        ret

Note the first movl overwriting the index register %edx.



More information about the Gcc-bugs mailing list