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

            Bug ID: 102197
           Summary: ABI to pass and return 32-bit FP vectors
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com, ubizjak at gmail dot com
  Target Milestone: ---
            Target: x86-64

[hjl@gnu-cfl-2 pr102143]$ cat v1sf.c
typedef float __v1sf __attribute__ ((__vector_size__ (4)));

struct s1sf
{
  float f;
};

extern __v1sf v1sf;
extern struct s1sf s1sf;

extern void foo1 (__v1sf);
extern void bar1 (struct s1sf);

__v1sf
foo2 (void)
{
  foo1 (v1sf);
  return v1sf;
}

struct s1sf
bar2 (void)
{
  bar1 (s1sf);
  return s1sf;
}
[hjl@gnu-cfl-2 pr102143]$ make v1sf.s
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O2 -S
v1sf.c
[hjl@gnu-cfl-2 pr102143]$ cat v1sf.s
        .file   "v1sf.c"
        .text
        .p2align 4
        .globl  foo2
        .type   foo2, @function
foo2:
.LFB0:
        .cfi_startproc
        pushq   %r12
        .cfi_def_cfa_offset 16
        .cfi_offset 12, -16
        movq    %rdi, %r12
        subq    $32, %rsp
        .cfi_def_cfa_offset 48
        movl    v1sf(%rip), %eax
        movl    %eax, (%rsp)
        call    foo1
        movl    v1sf(%rip), %eax
        movl    %eax, (%r12)
        addq    $32, %rsp
        .cfi_def_cfa_offset 16
        movq    %r12, %rax
        popq    %r12
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo2, .-foo2
        .p2align 4
        .globl  bar2
        .type   bar2, @function
bar2:
.LFB1:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movss   s1sf(%rip), %xmm0
        call    bar1
        movss   s1sf(%rip), %xmm0
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE1:
        .size   bar2, .-bar2
        .ident  "GCC: (GNU) 12.0.0 20210902 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr102143]$ 

Should __v1sf be passed and returned like struct s1sf?

Reply via email to