http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59041
Bug ID: 59041 Summary: [4.8/4.9 Regression] Unnecessary vzeroupper generated 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: ubizjak at gmail dot com [hjl@gnu-6 gcc]$ cat /tmp/j.cc #include <setjmp.h> extern jmp_buf buf; struct xxx { int foo (); int i; }; static void __attribute__((noinline)) bar (jmp_buf buf) { __builtin_longjmp (buf, 1); } int xxx::foo () { int j = i + 1; if (!__builtin_setjmp (buf)) { j += 1; bar (buf); } return j + i; } [hjl@gnu-6 gcc]$ ./xgcc -B./ -S -O2 -mavx /tmp/j.cc [hjl@gnu-6 gcc]$ cat j.s .file "j.cc" .section .text.unlikely,"ax",@progbits .type _ZL3barP13__jmp_buf_tag.constprop.0, @function _ZL3barP13__jmp_buf_tag.constprop.0: .LFB2: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq buf+8(%rip), %rax movq %rsp, %rbp .cfi_def_cfa_register 6 movq buf(%rip), %rbp movq buf+16(%rip), %rsp jmp *%rax .cfi_endproc .LFE2: .size _ZL3barP13__jmp_buf_tag.constprop.0, .-_ZL3barP13__jmp_buf_tag.constprop.0 .text .align 2 .p2align 4,,15 .globl _ZN3xxx3fooEv .type _ZN3xxx3fooEv, @function _ZN3xxx3fooEv: .LFB1: .cfi_startproc pushq %r15 .cfi_def_cfa_offset 16 .cfi_offset 15, -16 pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 pushq %r12 .cfi_def_cfa_offset 40 .cfi_offset 12, -40 pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 subq $16, %rsp .cfi_def_cfa_offset 72 movl (%rdi), %eax movq $.L4, buf+8(%rip) leaq 16(%rsp), %rcx movq %rdi, 8(%rsp) movq %rsp, buf+16(%rip) addl $2, %eax movq %rcx, buf(%rip) movl %eax, 4(%rsp) call _ZL3barP13__jmp_buf_tag.constprop.0 .L7: .p2align 4,,10 .p2align 3 .L4: movq 8(%rsp), %rdx movl 4(%rsp), %eax addl (%rdx), %eax vzeroupper <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Unnecessary vzeroupper addq $16, %rsp .cfi_def_cfa_offset 56 popq %rbx .cfi_def_cfa_offset 48 popq %rbp .cfi_def_cfa_offset 40 popq %r12 .cfi_def_cfa_offset 32 popq %r13 .cfi_def_cfa_offset 24 popq %r14 .cfi_def_cfa_offset 16 popq %r15 .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE1: .size _ZN3xxx3fooEv, .-_ZN3xxx3fooEv .ident "GCC: (GNU) 4.9.0 20131106 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 gcc]$