[Bug target/52838] New: [x32] missed optimization for pointer return value

bartoldeman at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Mon Apr 2 23:33:00 GMT 2012


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

             Bug #: 52838
           Summary: [x32] missed optimization for pointer return value
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bartoldeman@users.sourceforge.net


The program test.c:

extern void *foo(void);
extern void bar(void*);

void test(void)
{
  bar(foo());
}

when compiled with
gcc-4.7 -mx32 -Os -S test.c
produces:
    .file    "test.c"
    .text
    .globl    test
    .type    test, @function
test:
.LFB0:
    .cfi_startproc
    pushq    %rax
    .cfi_def_cfa_offset 16
    call    foo
    popq    %rdx
    .cfi_def_cfa_offset 8
    movq    %rax, %rdi
    jmp    bar
    .cfi_endproc
.LFE0:
    .size    test, .-test
    .ident    "GCC: (Debian 4.7.0-1) 4.7.0"
    .section    .note.GNU-stack,"",@progbits

Here "movq %rax, %rdi" could be replaced by "movl %eax, %edi", saving one
prefix byte 0x48.



More information about the Gcc-bugs mailing list