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

            Bug ID: 124697
           Summary: Unnecessary stack realignment
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

On x86-64, for

typedef struct {
  double a;
  double b;
  double c;
  double d;
} c __attribute__((aligned(32)));
extern double d;
void
e (float a1, float a2, float a3, float a4, float a5, float a6, c f)
{
  d = f.a;
}

-O2 generates

pushq %rbp
movq %rsp, %rbp
andq $-32, %rsp
movdqu 16(%rbp), %xmm0
movaps %xmm0, -32(%rsp)
movsd -32(%rsp), %xmm0
movsd %xmm0, d(%rip)
leave
ret

MEM_ALIGN (stack_parm) is properly aligned according to ISA
and ABI as set by target.   There is no need to realign stack
if address isn't taken.

Reply via email to