[Bug target/101456] New: Unnecessary vzeroupper when upper bits of YMM registers already zero

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 14 22:39:23 GMT 2021


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

            Bug ID: 101456
           Summary: Unnecessary vzeroupper when upper bits of YMM
                    registers already zero
           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
  Target Milestone: ---
            Target: i386, x86-64

Unnecessary vzeroupper:

[hjl@gnu-cfl-2 tmp]$ cat x.c 
#include <x86intrin.h>

extern __m256d x;

void
foo (void)
{
  x = _mm256_setzero_pd ();
}
[hjl@gnu-cfl-2 tmp]$ gcc -S -O2 x.c -mavx2 
c[hjl@gnu-cfl-2 tmp]$ cat x.s 
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB5667:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        vxorpd  %xmm0, %xmm0, %xmm0
        vmovapd %ymm0, x(%rip)
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        vzeroupper  <<<<<< Not needed since upper bits of YMM0 are zero.
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE5667:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 11.1.1 20210531 (Red Hat 11.1.1-3)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 tmp]$


More information about the Gcc-bugs mailing list