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

            Bug ID: 89545
           Summary: ABI clarification for over-aligned type stack passing
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For the following, if you compile with -O3 -mavx2
-fno-tree-loop-distribute-patterns -fno-ipa-cp you see vectorization assuming
32byte alignment of the stack slot for 'y' in foo.  That seems to be OK
given that main uses appropriately aligned stack-slots for the arguments
but I don't see this documented in the x86 ABI anywhere.

struct X { char x[32]; } __attribute__((aligned(32)));
struct X x;
struct Y { int i; float f; };

void __attribute__((noinline)) baz (struct X *p) { *(volatile char *)p->x; }

void __attribute__((noinline))
foo (int i1, int i2, int i3, int i4, int i5, int i6, struct X pad1, struct Y
pad, struct X y)
{
  for (unsigned i = 0; i < 32; ++i)
    y.x[i] = 1;
  baz (&y);
}

int main()
{
  struct Y y;
  foo (0,1,2,3,4,5, x, y, x);
}

Reply via email to