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

            Bug ID: 72819
           Summary: [AArch64] HFA structs of __fp16 incorrectly passed to
                    functions
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: jgreenhalgh at gcc dot gnu.org
          Reporter: jgreenhalgh at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*-*-*

It looks like we've not been handling structures of 16-bit floating-point
data correctly for AArch64. For some reason we end up passing them
packed in to integer registers. That is to say, on trunk and GCC 6, for:

  struct x {
    __fp16 x[4];
  };

  __fp16
  foo1 (struct x x)
  {
    return x.x[1];
  }

We generate:

  foo1:
        sbfx    x0, x0, 16, 16
        mov     v0.h[0], w0
        ret

Which is wrong. The structure should have been passed in h0,h1,h2,h3, and foo1
should just have been a move and a return.

Reply via email to