Commit 4a0d0ed2 by Martin Jambor Committed by Martin Jambor

Deferring FMA transformations in tight loops

2018-01-12  Martin Jambor  <mjambor@suse.cz>

	PR target/81616
	* params.def: New parameter PARAM_AVOID_FMA_MAX_BITS.
	* tree-ssa-math-opts.c: Include domwalk.h.
	(convert_mult_to_fma_1): New function.
	(fma_transformation_info): New type.
	(fma_deferring_state): Likewise.
	(cancel_fma_deferring): New function.
	(result_of_phi): Likewise.
	(last_fma_candidate_feeds_initial_phi): Likewise.
	(convert_mult_to_fma): Added deferring logic, split actual
	transformation to convert_mult_to_fma_1.
	(math_opts_dom_walker): New type.
	(math_opts_dom_walker::after_dom_children): New method, body moved
	here from pass_optimize_widening_mul::execute, added deferring logic
	bits.
	(pass_optimize_widening_mul::execute): Moved most of code to
	math_opts_dom_walker::after_dom_children.
	* config/i386/x86-tune.def (X86_TUNE_AVOID_128FMA_CHAINS): New.
	* config/i386/i386.c (ix86_option_override_internal): Added
	maybe_setting of PARAM_AVOID_FMA_MAX_BITS.

From-SVN: r256581
parent 80c93fa9
2018-01-12 Martin Jambor <mjambor@suse.cz>
PR target/81616
* params.def: New parameter PARAM_AVOID_FMA_MAX_BITS.
* tree-ssa-math-opts.c: Include domwalk.h.
(convert_mult_to_fma_1): New function.
(fma_transformation_info): New type.
(fma_deferring_state): Likewise.
(cancel_fma_deferring): New function.
(result_of_phi): Likewise.
(last_fma_candidate_feeds_initial_phi): Likewise.
(convert_mult_to_fma): Added deferring logic, split actual
transformation to convert_mult_to_fma_1.
(math_opts_dom_walker): New type.
(math_opts_dom_walker::after_dom_children): New method, body moved
here from pass_optimize_widening_mul::execute, added deferring logic
bits.
(pass_optimize_widening_mul::execute): Moved most of code to
math_opts_dom_walker::after_dom_children.
* config/i386/x86-tune.def (X86_TUNE_AVOID_128FMA_CHAINS): New.
* config/i386/i386.c (ix86_option_override_internal): Added
maybe_setting of PARAM_AVOID_FMA_MAX_BITS.
2018-01-12 Richard Biener <rguenther@suse.de> 2018-01-12 Richard Biener <rguenther@suse.de>
PR debug/83157 PR debug/83157
......
...@@ -4900,6 +4900,11 @@ ix86_option_override_internal (bool main_args_p, ...@@ -4900,6 +4900,11 @@ ix86_option_override_internal (bool main_args_p,
(cf_protection_level) (opts->x_flag_cf_protection | CF_SET); (cf_protection_level) (opts->x_flag_cf_protection | CF_SET);
} }
if (ix86_tune_features [X86_TUNE_AVOID_128FMA_CHAINS])
maybe_set_param_value (PARAM_AVOID_FMA_MAX_BITS, 128,
opts->x_param_values,
opts_set->x_param_values);
return true; return true;
} }
...@@ -403,6 +403,10 @@ DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes", ...@@ -403,6 +403,10 @@ DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes",
DEF_TUNE (X86_TUNE_USE_GATHER, "use_gather", DEF_TUNE (X86_TUNE_USE_GATHER, "use_gather",
~(m_ZNVER1 | m_GENERIC)) ~(m_ZNVER1 | m_GENERIC))
/* X86_TUNE_AVOID_128FMA_CHAINS: Avoid creating loops with tight 128bit or
smaller FMA chain. */
DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER1)
/*****************************************************************************/ /*****************************************************************************/
/* AVX instruction selection tuning (some of SSE flags affects AVX, too) */ /* AVX instruction selection tuning (some of SSE flags affects AVX, too) */
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -1326,6 +1326,11 @@ DEFPARAM(PARAM_UNROLL_JAM_MAX_UNROLL, ...@@ -1326,6 +1326,11 @@ DEFPARAM(PARAM_UNROLL_JAM_MAX_UNROLL,
"Maximum unroll factor for the unroll-and-jam transformation.", "Maximum unroll factor for the unroll-and-jam transformation.",
4, 0, 0) 4, 0, 0)
DEFPARAM(PARAM_AVOID_FMA_MAX_BITS,
"avoid-fma-max-bits",
"Maximum number of bits for which we avoid creating FMAs.",
0, 0, 512)
/* /*
Local variables: Local variables:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment