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

--- Comment #1 from Marc Glisse <marc.glisse at normalesup dot org> 2011-09-14 
08:23:15 UTC ---
Don't know if it is the same problem, but gcc seems to have trouble optimizing
with structs:

//typedef struct A { unsigned char t; } A;
typedef unsigned char A;
extern A f(A,A);
A g(A x,A y){ return f(y,x); }

Gives a nice:
    movzbl    %dil, %eax
    movzbl    %sil, %edi
    movl    %eax, %esi
    jmp    f

whereas if I use the struct definition on the line above:
    movl    %edi, %eax
    subq    $8, %rsp
    .cfi_def_cfa_offset 16
    movl    %esi, %edi
    movl    %eax, %esi
    call    f
    addq    $8, %rsp
    .cfi_def_cfa_offset 8
    ret

Somehow gcc doesn't realize that the 2 codes are equivalent (at least that's
how I understand the ABI).

Reply via email to