This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/84530] -mfunction-return=thunk does not work for simple_return_pop_internal insn
- From: "hjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 16 Apr 2018 19:07:04 +0000
- Subject: [Bug target/84530] -mfunction-return=thunk does not work for simple_return_pop_internal insn
- Auto-submitted: auto-generated
- References: <bug-84530-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84530
--- Comment #6 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Mon Apr 16 19:06:32 2018
New Revision: 259420
URL: https://gcc.gnu.org/viewcvs?rev=259420&root=gcc&view=rev
Log:
i386: Update -mfunction-return= for return with pop
When -mfunction-return= is used, simple_return_pop_internal should pop
return address into ECX register, adjust stack by bytes to pop from stack
and jump to the return thunk via ECX register.
Revision 257992 removed the bool argument from ix86_output_indirect_jmp.
Update comments to reflect it.
Tested on i686 and x86-64.
gcc/
Backport from mainline
2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (ix86_output_indirect_jmp): Update comments.
2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/84530
* config/i386/i386-protos.h (ix86_output_indirect_jmp): Remove
the bool argument.
(ix86_output_indirect_function_return): New prototype.
(ix86_split_simple_return_pop_internal): Likewise.
* config/i386/i386.c (indirect_return_via_cx): New.
(indirect_return_via_cx_bnd): Likewise.
(indirect_thunk_name): Handle return va CX_REG.
(output_indirect_thunk_function): Create alias for
__x86_return_thunk_[re]cx and __x86_return_thunk_[re]cx_bnd.
(ix86_output_indirect_jmp): Remove the bool argument.
(ix86_output_indirect_function_return): New function.
(ix86_split_simple_return_pop_internal): Likewise.
* config/i386/i386.md (*indirect_jump): Don't pass false
to ix86_output_indirect_jmp.
(*tablejump_1): Likewise.
(simple_return_pop_internal): Change it to define_insn_and_split.
Call ix86_split_simple_return_pop_internal to split it for
-mfunction-return=.
(simple_return_indirect_internal): Call
ix86_output_indirect_function_return instead of
ix86_output_indirect_jmp.
gcc/testsuite/
Backport from mainline
2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/84530
* gcc.target/i386/ret-thunk-22.c: New test.
* gcc.target/i386/ret-thunk-23.c: Likewise.
* gcc.target/i386/ret-thunk-24.c: Likewise.
* gcc.target/i386/ret-thunk-25.c: Likewise.
* gcc.target/i386/ret-thunk-26.c: Likewise.
Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-22.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-23.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-24.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-25.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/i386/i386-protos.h
branches/gcc-6-branch/gcc/config/i386/i386.c
branches/gcc-6-branch/gcc/config/i386/i386.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog