https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82499

            Bug ID: 82499
           Summary: x86: small stack initial adjustments could use push
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benjamin at benjamin dot pe
  Target Milestone: ---

consider:
extern void g(void);
int f() {
    g();
    return 42;
}

For f, gcc -Os on the trunk generates

  subq $8, %rsp
  call g
  movl $42, %eax
  popq %rdx
  ret

clang 5.0.0 cleverly generates:

  pushq %rax
  callq g
  movl $42, %eax
  popq %rcx
  retq

"pushq %rax" ends up being 2 bytes shorter than "subq $8, %rsp".

Reply via email to