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 other/27567] New: __builtin_memcpy generates redundant stores/moves.


float convert( unsigned in )
{
        float f;
        __builtin_memcpy( &f, &in, sizeof( in ) );
        return f;
}

$ gcc bug.c -S -O2 -fverbose-asm -m64

convert:
        movl    %edi, -4(%rsp)  # in, f
        movl    %edi, -20(%rsp) # in, in      <=== what for this?
        movss   -4(%rsp), %xmm0 # f, <result>
        ret

$ gcc bug.c -S -O2 -fverbose-asm -m32

convert:
        pushl   %ebp    #
        movl    %esp, %ebp      #,
        subl    $16, %esp       #,
        movl    8(%ebp), %eax   # in, in   \
        movl    %eax, -4(%ebp)  # in, f    |--- why not flds 8(%ebp) ?
        flds    -4(%ebp)        # f        /
        leave
        ret


-- 
           Summary: __builtin_memcpy generates redundant stores/moves.
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: x86-*-linux
  GCC host triplet: x86-*-linux
GCC target triplet: x86-*-linux


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


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