http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60204

            Bug ID: 60204
           Summary: struct with __m512i is mishandled in function
                    parameter passing and return
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: kirill.yukhin at intel dot com

[hjl@gnu-6 avx512-1]$ cat x.i
typedef long long __m512i __attribute__ ((__vector_size__ (64),
__may_alias__));

struct m512i
{
  __m512i x;
};

typedef long long __m256i __attribute__ ((__vector_size__ (32),
__may_alias__));

struct m256i
{
  __m256i x;
};

struct m256i
foo1 (struct m256i x, struct m256i y, struct m256i z)
{
  return z;
}

struct m512i
foo2 (struct m512i x, struct m512i y, struct m512i z)
{
  return z;
}
[hjl@gnu-6 avx512-1]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -mavx512f -O2 -S x.i
[hjl@gnu-6 avx512-1]$ cat x.s
    .file    "x.i"
    .section    .text.unlikely,"ax",@progbits
.LCOLDB0:
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    foo1
    .type    foo1, @function
foo1:
.LFB0:
    .cfi_startproc
    vmovdqa    %ymm2, %ymm0
    ret
    .cfi_endproc
.LFE0:
    .size    foo1, .-foo1
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .section    .text.unlikely
.LCOLDB1:
    .text
.LHOTB1:
    .p2align 4,,15
    .globl    foo2
    .type    foo2, @function
foo2:
.LFB1:
    .cfi_startproc
    vmovdqa64    136(%rsp), %zmm0
    movq    %rdi, %rax
    vmovdqa64    %zmm0, (%rdi)
    ret
    .cfi_endproc
.LFE1:
    .size    foo2, .-foo2
    .section    .text.unlikely
.LCOLDE1:
    .text
.LHOTE1:
    .ident    "GCC: (GNU) 4.9.0 20140214 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-6 avx512-1]$ 

I am expecting struct m512i is passed/returned in zmm register per
AVX-512 extension to x86-64 psABI.

Reply via email to