------- Comment #2 from pluto at agmk dot net  2007-11-14 11:14 -------
and the c++ testcase with __builtin_memcpy:

template < int N >
unsigned char memcpy_byte( unsigned long long x )
{
    unsigned char rv;
    __builtin_memcpy( &rv, N + reinterpret_cast< unsigned char* >( &x ),
        sizeof( rv ) );
    return rv;
}

template unsigned char memcpy_byte< 0 >( unsigned long long );
template unsigned char memcpy_byte< 1 >( unsigned long long );
template unsigned char memcpy_byte< 6 >( unsigned long long );
template unsigned char memcpy_byte< 7 >( unsigned long long );

unsigned char memcpy_byte<0>(unsigned long long):
        subl    $28, %esp
        movzbl  32(%esp), %eax  # 13    *movqi_1/3      [length = 5]
        addl    $28, %esp
        ret

unsigned char memcpy_byte<1>(unsigned long long):
        subl    $28, %esp
        movzwl  32(%esp), %eax  # 34    *movhi_1/3      [length = 5]
        addl    $28, %esp
        shrw    $8, %ax         # 14    *lshrhi3_1/1    [length = 4]
        ret

unsigned char memcpy_byte<6>(unsigned long long):
        subl    $28, %esp
        movzbl  38(%esp), %eax  # 14    *movqi_1/3      [length = 5]
        addl    $28, %esp
        ret

unsigned char memcpy_byte<7>(unsigned long long):
        subl    $28, %esp
        movzbl  39(%esp), %eax  # 14    *movqi_1/3      [length = 5]
        addl    $28, %esp
        ret


-- 


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

Reply via email to