unsigned short load( void* p )
{
        unsigned short v;
        __builtin_memcpy( &v, p, sizeof( v ) );
        return v;
}

recent 4.2 branch produces:

load:   movzwl  (%rdi), %eax
        movw    %ax, -2(%rsp)
        movzwl  %ax, %eax
        ret

revsion 101665 produces optimal code:

load:   movzwl  (%rdi), %eax
        ret

the regression was introduced by Fariborz Jahanian:
http://gcc.gnu.org/viewcvs?view=rev&revision=101666


-- 
           Summary: [4.1/4.2 regression] code pessimization after -fforce-
                    mem removal.
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: x86_64-linux


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

Reply via email to