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

            Bug ID: 85667
           Summary: (x86_64) ms_abi rules aren't followed when returning
                    short structs with float values
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: green at redhat dot com
  Target Milestone: ---

Structs 8 bytes or shorter with floating point values should return in eax.

GCC 8.0.1 (at least) doesn't follow those rules.  It is using the sysv ABI
rules instead.

See this code, for example:

typedef struct
{
  float x;
} Float;

Float  __attribute__((ms_abi)) fn1()
{
  Float v;
  v.x = 3.145;
  return v;
}

Float fn2 ()
{
  Float v;
  v.x = 3.145;
  return v;
}


GCC's output for fn1 and fn2 are similar:

fn1:
        movss   .LC0(%rip), %xmm0
        ret

fn2:
        movss   .LC0(%rip), %xmm0
        ret


Clang does this correctly, however, and fn1 looks like this:

fn1:
        movl    $1078544302, %eax
        retq

fn2: 
        movss   .LCPI1_0(%rip), %xmm0 
        retq

Reply via email to