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

            Bug ID: 60638
           Summary: Frame pointer vs push/pop
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: kirill.yukhin at intel dot com, ubizjak at gmail dot com
            Target: i686

GCC 4.9 disables -maccumulate-outgoing-args for -mtune=generic.
For 32-bit, given

extern int InputMove(char*, int, int, int, int);
int OutputGood(char* text, int ply, int wtm)
{
  int new_move;
  new_move=InputMove(text,ply,wtm,1,0);
  return ((((new_move)>>12)&7));
}

-m32 -O2 -mtune=generic generates:

    .p2align 4,,15
    .globl    OutputGood
    .type    OutputGood, @function
OutputGood:
.LFB0:
    .cfi_startproc
    subl    $24, %esp
    .cfi_def_cfa_offset 28
    pushl    $0
    .cfi_def_cfa_offset 32
    pushl    $1
    .cfi_def_cfa_offset 36
    pushl    44(%esp)
    .cfi_def_cfa_offset 40
    pushl    44(%esp)
    .cfi_def_cfa_offset 44
    pushl    44(%esp)
    .cfi_def_cfa_offset 48
    call    InputMove
    sarl    $12, %eax
    addl    $44, %esp
    .cfi_def_cfa_offset 4
    andl    $7, %eax
    ret
    .cfi_endproc
.LFE0:
    .size    OutputGood, .-OutputGood

-m32 -O2 -mtune=generic -maccumulate-outgoing-args generates

    .type    OutputGood, @function
OutputGood:
.LFB0:
    .cfi_startproc
    subl    $44, %esp
    .cfi_def_cfa_offset 48
    movl    56(%esp), %eax
    movl    $0, 16(%esp)
    movl    $1, 12(%esp)
    movl    %eax, 8(%esp)
    movl    52(%esp), %eax
    movl    %eax, 4(%esp)
    movl    48(%esp), %eax
    movl    %eax, (%esp)
    call    InputMove
    sarl    $12, %eax
    addl    $44, %esp
    .cfi_def_cfa_offset 4
    andl    $7, %eax
    ret
    .cfi_endproc
.LFE0:
    .size    OutputGood, .-OutputGood

-m32 -O2 -mtune=generic -fno-omit-frame-pointer generates:

    .type    OutputGood, @function
OutputGood:
.LFB0:
    .cfi_startproc
    pushl    %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    subl    $20, %esp
    pushl    $0
    pushl    $1
    pushl    16(%ebp)
    pushl    12(%ebp)
    pushl    8(%ebp)
    call    InputMove
    sarl    $12, %eax
    leave
    .cfi_restore 5
    .cfi_def_cfa 4, 4
    andl    $7, %eax
    ret
    .cfi_endproc
.LFE0:
    .size    OutputGood, .-OutputGood

push/pop generates the largest unwind info.  Should we disable
-fomit-frame-pointer if -maccumulate-outgoing-args is also disabled
for 32-bit?

Reply via email to