[Bug target/100704] New: Vector register isn't used to push BLKmode argument onto stack

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu May 20 13:58:50 GMT 2021


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

            Bug ID: 100704
           Summary: Vector register isn't used to push BLKmode argument
                    onto stack
           Product: gcc
           Version: 11.1.1
            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: i386,x86-64

[hjl@gnu-cfl-2 gcc]$ cat /tmp/x.c
struct S
{
  long long s1 __attribute__ ((aligned (8)));
  unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
};

extern struct S array[];

void bar (struct S x);

void
foo (void)
{
  bar (array[0]);
}
[hjl@gnu-cfl-2 gcc]$ gcc -S -O2 /tmp/x.c
[hjl@gnu-cfl-2 gcc]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        pushq   array+56(%rip)
        .cfi_def_cfa_offset 24
        pushq   array+48(%rip)
        .cfi_def_cfa_offset 32
        pushq   array+40(%rip)
        .cfi_def_cfa_offset 40
        pushq   array+32(%rip)
        .cfi_def_cfa_offset 48
        pushq   array+24(%rip)
        .cfi_def_cfa_offset 56
        pushq   array+16(%rip)
        .cfi_def_cfa_offset 64
        pushq   array+8(%rip)
        .cfi_def_cfa_offset 72
        pushq   array(%rip)
        .cfi_def_cfa_offset 80
        call    bar
        addq    $72, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 11.1.1 20210428 (Red Hat 11.1.1-1)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 gcc]$ 

[hjl@gnu-cfl-2 gcc]$ ./xgcc -B./ -S -O2 /tmp/x.c -mno-push-args
[hjl@gnu-cfl-2 gcc]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        subq    $72, %rsp
        .cfi_def_cfa_offset 80
        movdqu  array(%rip), %xmm0
        movdqu  array+16(%rip), %xmm1
        movdqu  array+32(%rip), %xmm2
        movdqu  array+48(%rip), %xmm3
        movups  %xmm0, (%rsp)
        movups  %xmm1, 16(%rsp)
        movups  %xmm2, 32(%rsp)
        movups  %xmm3, 48(%rsp)
        call    bar
        addq    $72, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 12.0.0 20210519 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 gcc]$ 

There is

#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)

Can we update PUSH_ARGS to also check function arguments?


More information about the Gcc-bugs mailing list