This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH], Remove undocumented -mtoc-fusion from PowerPC


Back in the days when I was developing the extended fusion support for PowerPC
(-mpower9-fusion), I added a partially implemented option called toc fusion.
The idea was to recognize TOC entries (that normally get split into HIGH/LO_SUM
pairs) early on, and keep the pairs together.  Unfortunately, I messed the
setting, and you could not actually use -mtoc-fusion without also setting
-mcmodel=medium, since the TOC fusion tests in rs6000.c occured before the
default code model was set in SUBSUBTARGET_OPTIONS.  However, I stopped doing
fusion work to do other things (basic power9 enablement and IEEE 128-bit
floating point).

While it would be simple to move the tests for TOC fusion to after the location
where the code model is set, I'm thinking that the current code is rather
limited.  Right now, toc fusion replaces each TOC reference with a new insn
that has the scratch register as a clobber.  However, if you have multiple
references to the same variable (such as doing the ++/-- operators) in a basic
block or referencs to variables whose location near to the variable you
previously referenced, we will generate multiple ADDIS operations.

I have ideas how to a better job of fusion for current and future machines
using a machine dependent pass to do fusion optimizations within a basic block.
This means rather than keeping the toc fusion around (that nobody used), I
would prefer to delete the current code, and replace it with better code as I
implement it.

I have tested this on a power8 little endian system with a bootstrap build and
with make check.  There were no regressions.  In addition, I built the full
spec 2006 CPU benchmark suite for power9 to make sure I didn't accidently
delete insns that are used for -mpower9-fusion.  Can I check this into the
trunk?  I don't anticipate that we will need a backport to the FSF GCC 8
branch.

2018-07-13  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/constraints.md (wG constraint): Delete, no longer
	used.
	* config/rs6000/predicates.md (p9_fusion_reg_operand): Rename
	predicate to reflect toc fusion has been deleted.
	(toc_fusion_mem_raw): Delete, no longer used.
	(toc_fusion_mem_wrapped): Likewise.
	* config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Delete toc
	fusion mask bit.
	* config/rs6000/rs6000-protos.h (fusion_wrap_memory_address):
	Delete, no longer used.
	* config/rs6000/rs6000.c (struct rs6000_reg_addr): Delete fields
	meant to be used for toc fusion.
	(rs6000_debug_print_mode): Delete toc fusion debugging.
	(rs6000_debug_reg_global): Likewise.
	(rs6000_init_hard_regno_mode_ok): Delete setting up fields for toc
	fusion and secondary reload support that were never used.
	(rs6000_option_override_internal): Delete TOC fusion, that was only
	partially defined, and it did not work unless you also used the
	-mcmodel= switch.
	(rs6000_legitimate_address_p): Delete TOC fusion support.
	(rs6000_opt_masks): Likewise.
	(fusion_wrap_memory_address): Delete function, no longer used.
	(fusion_split_address); Delete TOC fusion support.
	* config/rs6000/rs6000.h (TARGET_TOC_FUSION_INT): Delete, no
	longer used with toc fusion being deleted.
	(TARGET_TOC_FUSION_FP): Likewise.
	* config/rs6000/rs6000.md (UNSPEC_FUSION_ADDIS): Delete TOC fusion
	UNSPEC.
	(toc fusion spliter): Delete TOC fusion support.
	(toc_fusionload_<mode>): Likewise.
	(toc_fusionload_di): Likewise.
	(fusion_gpr_load_<mode>): Delete generator function, this insn no
	longer needs to be named.  Rename predicate to delete TOC fusion.
	(fusion_gpr_<P:mode>_<GPR_FUSION:mode>_load): Likewise.
	(fusion_gpr_<P:mode>_<GPR_FUSION:mode>_store): Likewise.
	(fusion_vsx_<P:mode>_<GPR_FUSION:mode>_load): Likewise.
	(fusion_vsx_<P:mode>_<GPR_FUSION:mode>_store): Likewise.
	(p9 fusion peephole2s): Rename predicate to delete TOC fusion.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

Attachment: ext-addr.rev5.patch01b
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]