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: unassig...@gcc.gnu.org

        ReportedBy: m...@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.

Reply via email to