public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v4 0/12] [i386] Improve 64-bit Microsoft to System V ABI pro/epilogues
@ 2017-04-27  8:05 Daniel Santos
  2017-04-27  8:05 ` [PATCH 02/12] [i386] Keep stack pointer valid after after re-alignment Daniel Santos
                   ` (14 more replies)
  0 siblings, 15 replies; 41+ messages in thread
From: Daniel Santos @ 2017-04-27  8:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Uros Bizjak, Jan Hubicka

All of patches are concerned with 64-bit Microsoft ABI functions that 
call System V ABI function which clobbers RSI, RDI and XMM6-15 and are 
aimed at improving performance and .text size of Wine 64. I had 
previously submitted these as separate patch sets, but have combined 
them for simplicity. (Does this make the ChangeLogs too big? Please let 
me know if you want me to break these back apart.) Below are the 
included patchsets and a summary of changes since the previous post(s):

1.) PR78962 Use aligned SSE movs for re-aligned MS ABI pro/epilogues. 
https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01859.html

Changes:

  * The SEH unwind emit code (in winnt.c) does not currently support
    CFA_REG_EXPRESSION, which is required to make this work, so I have
    disabled it on SEH targets.
  * Updated comments on CFA_REG_EXPRESSION in winnt.c.


2.) Add option to call out-of-line stubs instead of emitting inline 
saves and restores. https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00548.html

Changes:

  * Renamed option from -moutline-msabi-xlogues to -mcall-ms2sysv-xlogues
  * Since this patch set depends upon aligned SSE MOVs after stack
    realignment, I have disabled it on SEH targets with a sorry().
  * I was previously trying to cache the rtx for symbols to the libgcc
    stubs instead of creating new ones, but this caused problems in
    subsequent passes and it was disabled with a "TODO" comment. I have
    removed this code, as well as the rtx cache that was just wasting
    memory in class xlogue_layout.
  * Improved comment documentation.


3.) A comprehensive test program to validate correct behavior in these 
pro- and epilogues. https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00542.html

Changes:

  * The previous version repeated all tests for each -j<jobs> instead of
    running in parallel. I have fixed this implementing a primitive but
    effective file-based parallelization scheme.
  * I noticed that there was gcc/testsuite/gcc.target/x86_64/abi
    directory for tests specific to testing 64-bit abi issues, so I've
    moved my tests to an "ms-sysv" subdirectory of that (instead of
    gcc/testsuite/gcc.target/i386/msabi).
  * Fixed breakages on Cygwin.
  * Corrected a bad "_noinfo" optimization barrier (function call by
    volatile pointer).
  * Minor cleanup/improvements.


  gcc/Makefile.in                                    |   2 +
  gcc/config/i386/i386.c                             | 916 +++++++++++++++++++--
  gcc/config/i386/i386.h                             |  33 +-
  gcc/config/i386/i386.opt                           |   4 +
  gcc/config/i386/predicates.md                      | 155 ++++
  gcc/config/i386/sse.md                             |  37 +
  gcc/config/i386/winnt.c                            |   3 +-
  gcc/doc/invoke.texi                                |  13 +-
  .../gcc.target/x86_64/abi/ms-sysv/do-test.S        | 163 ++++
  gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/gen.cc | 807 ++++++++++++++++++
  .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.c        | 373 +++++++++
  .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp      | 178 ++++
  libgcc/config.host                                 |   2 +-
  libgcc/config/i386/i386-asm.h                      |  82 ++
  libgcc/config/i386/resms64.S                       |  57 ++
  libgcc/config/i386/resms64f.S                      |  55 ++
  libgcc/config/i386/resms64fx.S                     |  57 ++
  libgcc/config/i386/resms64x.S                      |  59 ++
  libgcc/config/i386/savms64.S                       |  57 ++
  libgcc/config/i386/savms64f.S                      |  55 ++
  libgcc/config/i386/t-msabi                         |   7 +
  21 files changed, 3020 insertions(+), 95 deletions(-)	


gcc/ChangeLog:

2017-04-25  Daniel Santos<daniel.santos@pobox.com>

	* config/i386/i386.opt: Add option -mcall-ms2sysv-xlogues.
	* config/i386/i386.h
	(x86_64_ms_sysv_extra_clobbered_registers): Change type to unsigned.
	(NUM_X86_64_MS_CLOBBERED_REGS): New macro.
	(struct machine_function): Add new members call_ms2sysv,
	call_ms2sysv_pad_in, call_ms2sysv_pad_out and call_ms2sysv_extra_regs.
	(struct machine_frame_state): New fields sp_realigned and
	sp_realigned_offset.
	* config/i386/i386.c
	(enum xlogue_stub): New enum.
	(enum xlogue_stub_sets): New enum.
	(class xlogue_layout): New class.
	(struct ix86_frame): New fields stack_realign_allocate_offset,
	stack_realign_offset and outlined_save_offset.  Modify comments to
	detail stack layout when using out-of-line stubs.
	(ix86_target_string): Add -mcall-ms2sysv-xlogues option.
	(ix86_option_override_internal): Add sorry() for TARGET_SEH and
	-mcall-ms2sysv-xlogues.
	(stub_managed_regs): New static variable.
	(ix86_save_reg): Add new parameter ignore_outlined to optionally omit
	registers managed by out-of-line stub.
	(disable_call_ms2sysv_xlogues): New function.
	(ix86_compute_frame_layout): Modify re-alignment calculations, disable
	m->call_ms2sysv when appropriate and compute frame layout for
	out-of-line stubs.
	(sp_valid_at, fp_valid_at): New inline functions.
	(choose_basereg): New function.
	(choose_baseaddr): Add align parameter, use choose_basereg and modify
	all callers.
	(ix86_emit_save_reg_using_mov, ix86_emit_restore_sse_regs_using_mov):
	Use align parameter of choose_baseaddr to generated aligned SSE movs
	when possible.
	(pro_epilogue_adjust_stack): Modify to track
	machine_frame_state::sp_realigned.
	(ix86_nsaved_regs): Modify to accommodate changes to ix86_save_reg.
	(ix86_nsaved_sseregs): Likewise.
	(ix86_emit_save_regs): Likewise.
	(ix86_emit_save_regs_using_mov): Likewise.
	(ix86_emit_save_sse_regs_using_mov): Likewise.
	(get_scratch_register_on_entry): Likewise.
	(gen_frame_set): New function.
	(gen_frame_load): Likewise.
	(gen_frame_store): Likewise.
	(emit_outlined_ms2sysv_save): Likewise.
	(emit_outlined_ms2sysv_restore): Likewise.
	(ix86_expand_prologue): Modify stack re-alignment code and call
	emit_outlined_ms2sysv_save when appropriate.
	(ix86_emit_leave): Clear machine_frame_state::sp_realigned.  Add
	parameter rtx_insn *insn, which allows the function to be used to only
	generate the notes.
	(ix86_expand_epilogue): Modify validity checks of frame and stack
	pointers, and call emit_outlined_ms2sysv_restore when appropriate.
	(ix86_expand_call): Modify to enable m->call_ms2sysv when appropriate.
	* config/i386/predicates.md
	(save_multiple): New predicate.
	(restore_multiple): Likewise.
	* config/i386/sse.md
	(save_multiple<mode>): New pattern.
	(save_multiple_realign<mode>): Likewise.
	(restore_multiple<mode>): Likewise.
	(restore_multiple_and_return<mode>): Likewise.
	(restore_multiple_leave_return<mode>): Likewise.
	* Makefile.in: Export HOSTCXX and HOSTCXXFLAGS to site.exp

gcc/testsuite/ChangeLog:

2017-04-25  Daniel Santos<daniel.santos@pobox.com>

	* config.host: Add i386/t-msabi to i386/t-linux file list.
	* config/i386/i386-asm.h: New file.
	* config/i386/resms64.S: New file.
	* config/i386/resms64f.S: New file.
	* config/i386/resms64fx.S: New file.
	* config/i386/resms64x.S: New file.
	* config/i386/savms64.S: New file.
	* config/i386/savms64f.S: New file.
	* config/i386/t-msabi: New file.

libgcc/ChangeLog:

2017-04-25  Daniel Santos<daniel.santos@pobox.com>

	* gcc.target/x86_64/abi/ms-sysv/do-test.S: New file.
	* gcc.target/x86_64/abi/ms-sysv/gen.cc: Likewise.
	* gcc.target/x86_64/abi/ms-sysv/ms-sysv.c: Likewise.
	* gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp: Likewise.

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2017-07-31 10:25 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27  8:05 [PATCH v4 0/12] [i386] Improve 64-bit Microsoft to System V ABI pro/epilogues Daniel Santos
2017-04-27  8:05 ` [PATCH 02/12] [i386] Keep stack pointer valid after after re-alignment Daniel Santos
2017-04-27  8:05 ` [PATCH 03/12] [i386] Use re-aligned stack pointer for aligned SSE movs Daniel Santos
2017-04-27  8:05 ` [PATCH 05/12] [i386] Add option -mcall-ms2sysv-xlogues Daniel Santos
2017-04-28  6:00   ` Sandra Loosemore
2017-04-28  7:37     ` [PATCH 05/12 rev 1] " Daniel Santos
2017-04-27  8:05 ` [PATCH 09/12] [i386] Add patterns and predicates foutline-msabi-xlouges Daniel Santos
2017-05-01 11:18   ` Uros Bizjak
2017-05-02 22:19     ` Daniel Santos
2017-05-03  6:17       ` Uros Bizjak
2017-05-03  7:38         ` Daniel Santos
2017-05-03  8:38           ` Uros Bizjak
2017-05-04 21:35   ` [PATCH 09/12 rev1] [i386] Add patterns and predicates mcall-ms2sysv-xlogues Daniel Santos
2017-04-27  8:05 ` [PATCH 11/12] [i386] Add remainder of -mcall-ms2sysv-xlogues implementation Daniel Santos
2017-05-04 22:11   ` [PATCH 11/12 rev1] " Daniel Santos
2017-04-27  8:05 ` [PATCH 12/12] [i386,testsuite] Test program for ms to sysv abi function calls Daniel Santos
2017-05-17  9:52   ` Thomas Preudhomme
2017-04-27  8:05 ` [PATCH 01/12] [i386] Re-align stack frame prior to SSE saves Daniel Santos
2017-04-27  8:05 ` [PATCH 08/12] [i386] Modify ix86_compute_frame_layout for -mcall-ms2sysv-xlogues Daniel Santos
2017-04-27  8:05 ` [PATCH 10/12] [i386] Add ms2sysv pro/epilogue stubs to libgcc Daniel Santos
2017-04-27  8:23 ` [PATCH 04/12] [i386] Minor refactoring Daniel Santos
2017-04-27  8:44 ` [PATCH 07/12] [i386] Modify ix86_save_reg to optionally omit stub-managed registers Daniel Santos
2017-04-27  8:51 ` [PATCH 06/12] [i386] Add class xlogue_layout and new fields to struct machine_function Daniel Santos
2017-04-27 18:32 ` [PATCH v4 0/12 GCC8] [i386] Improve 64-bit Microsoft to System V ABI pro/epilogues Daniel Santos
2017-05-01 11:31 ` [PATCH v4 0/12] " Uros Bizjak
2017-05-02 10:25   ` JonY
2017-05-02 10:45     ` Kai Tietz
2017-05-03  6:01       ` Daniel Santos
2017-05-05  9:05       ` Daniel Santos
2017-05-06 20:41         ` Daniel Santos
2017-05-08 20:07           ` Daniel Santos
2017-05-03  4:32     ` Daniel Santos
2017-05-13  0:01 ` [PING] " Daniel Santos
2017-05-13 18:29   ` Uros Bizjak
2017-05-13 23:43     ` Daniel Santos
2017-05-14 10:25       ` Uros Bizjak
2017-07-26 19:03         ` H.J. Lu
2017-07-27  0:36           ` Daniel Santos
2017-07-28 13:51           ` Daniel Santos
2017-07-28 14:41             ` H.J. Lu
2017-07-31 10:25               ` Daniel Santos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).