From 74460d8c34a44befb1dff1f3d119ca36257a5978 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 11 Nov 2011 19:58:10 +0000 Subject: [PATCH] * config/i386/i386-protos.h (ix86_maybe_emit_epilogue_vzeroupper): New prototype. * config/i386/i386.c (ix86_maybe_emit_epilogue_vzeroupper): New function. (ix86_expand_epilogue): Use it. * config/i386/i386.md (return, simple_return): Call it in the expanders. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181300 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386-protos.h | 1 + gcc/config/i386/i386.c | 16 ++++++++++++---- gcc/config/i386/i386.md | 2 ++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 40c57d1..73bec22 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2011-11-11 Jakub Jelinek + * config/i386/i386-protos.h (ix86_maybe_emit_epilogue_vzeroupper): + New prototype. + * config/i386/i386.c (ix86_maybe_emit_epilogue_vzeroupper): New + function. + (ix86_expand_epilogue): Use it. + * config/i386/i386.md (return, simple_return): Call it in the + expanders. + PR tree-optimization/51091 * tree-stdarg.c (execute_optimize_stdarg): Ignore TREE_CLOBBER_P rhs also in the va_list_simple_ptr case. diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 6bfe13d..630112f 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -32,6 +32,7 @@ extern void ix86_setup_frame_addresses (void); extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int); extern void ix86_expand_prologue (void); +extern void ix86_maybe_emit_epilogue_vzeroupper (void); extern void ix86_expand_epilogue (int); extern void ix86_expand_split_stack_prologue (void); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f39eb11..7c5814f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -10614,6 +10614,17 @@ ix86_emit_restore_sse_regs_using_mov (HOST_WIDE_INT cfa_offset, } } +/* Emit vzeroupper if needed. */ + +void +ix86_maybe_emit_epilogue_vzeroupper (void) +{ + if (TARGET_VZEROUPPER + && !TREE_THIS_VOLATILE (cfun->decl) + && !cfun->machine->caller_return_avx256_p) + emit_insn (gen_avx_vzeroupper (GEN_INT (call_no_avx256))); +} + /* Restore function stack, frame, and registers. */ void @@ -10911,10 +10922,7 @@ ix86_expand_epilogue (int style) } /* Emit vzeroupper if needed. */ - if (TARGET_VZEROUPPER - && !TREE_THIS_VOLATILE (cfun->decl) - && !cfun->machine->caller_return_avx256_p) - emit_insn (gen_avx_vzeroupper (GEN_INT (call_no_avx256))); + ix86_maybe_emit_epilogue_vzeroupper (); if (crtl->args.pops_args && crtl->args.size) { diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 377c78e..bc60253 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11736,6 +11736,7 @@ [(simple_return)] "ix86_can_use_return_insn_p ()" { + ix86_maybe_emit_epilogue_vzeroupper (); if (crtl->args.pops_args) { rtx popc = GEN_INT (crtl->args.pops_args); @@ -11752,6 +11753,7 @@ [(simple_return)] "!TARGET_SEH" { + ix86_maybe_emit_epilogue_vzeroupper (); if (crtl->args.pops_args) { rtx popc = GEN_INT (crtl->args.pops_args); -- 2.7.4