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

            Bug ID: 119583
           Summary: -fomit-frame-pointer does not work as expected for
                    -mavx
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
  Target Milestone: ---

Reproducer:

struct S
{
  char c[32];
};

extern int ext_f (void *);

void f (void)
{
  struct S pe = {};
  ext_f(&pe);
  asm volatile ("xor %%rbp, %%rbp" ::: "rbp");
}

$ gcc/cc1 -quiet -fomit-frame-pointer -mavx -mpreferred-stack-boundary=5
/tmp/repro.c -o -
        .file   "repro.c"
        .text
        .globl  f
        .type   f, @function
f:
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        subq    $48, %rsp
        .cfi_def_cfa_offset 64
        vpxor   %xmm0, %xmm0, %xmm0
        vmovdqu %ymm0, (%rsp)
        movq    %rsp, %rax
        movq    %rax, %rdi
        call    ext_f
#APP
# 12 "/tmp/repro.c" 1
        xor %rbp, %rbp
# 0 "" 2
#NO_APP
        nop
        addq    $48, %rsp
        .cfi_def_cfa_offset 16
        popq    %rbp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   f, .-f
        .ident  "GCC: (GNU) 15.0.1 20250327 (experimental)"
        .section        .note.GNU-stack,"",@progbits


The spill:

        vmovdqu %ymm0, (%rsp)

needs a stack alignment adjustment from the default 128 bit to 256 bit, which
-fomit-frame-pointer appears to trip on.  Does it make sense to set the
preferred alignment to 256 bits for avx?

Reply via email to