Commit 25e22b19 by H.J. Lu Committed by H.J. Lu

i386: Add clear_ratio to processor_costs

i386.h has

 #define CLEAR_RATIO(speed) ((speed) ? MIN (6, ix86_cost->move_ratio) : 2)

It is impossible to have CLEAR_RATIO > 6.  This patch adds clear_ratio
to processor_costs, sets it to the minimum of 6 and move_ratio in all
cost models and defines CLEAR_RATIO with clear_ratio.

	* config/i386/i386.h (processor_costs): Add clear_ratio.
	(CLEAR_RATIO): Remove MIN and use ix86_cost->clear_ratio.
	* config/i386/x86-tune-costs.h: Set clear_ratio to the minimum
	of 6 and move_ratio in all cost models.

From-SVN: r277114
parent 47519a56
2019-10-17 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.h (processor_costs): Add clear_ratio.
(CLEAR_RATIO): Remove MIN and use ix86_cost->clear_ratio.
* config/i386/x86-tune-costs.h: Set clear_ratio to the minimum
of 6 and move_ratio in all cost models.
2019-10-17 Richard Biener <rguenther@suse.de> 2019-10-17 Richard Biener <rguenther@suse.de>
* tree-vect-loop.c (check_reduction_path): Compute reduction * tree-vect-loop.c (check_reduction_path): Compute reduction
......
...@@ -291,6 +291,8 @@ struct processor_costs { ...@@ -291,6 +291,8 @@ struct processor_costs {
const int large_insn; /* insns larger than this cost more */ const int large_insn; /* insns larger than this cost more */
const int move_ratio; /* The threshold of number of scalar const int move_ratio; /* The threshold of number of scalar
memory-to-memory move insns. */ memory-to-memory move insns. */
const int clear_ratio; /* The threshold of number of scalar
memory clearing insns. */
const int int_load[3]; /* cost of loading integer registers const int int_load[3]; /* cost of loading integer registers
in QImode, HImode and SImode relative in QImode, HImode and SImode relative
to reg-reg move (2). */ to reg-reg move (2). */
...@@ -1947,7 +1949,7 @@ typedef struct ix86_args { ...@@ -1947,7 +1949,7 @@ typedef struct ix86_args {
/* If a clear memory operation would take CLEAR_RATIO or more simple /* If a clear memory operation would take CLEAR_RATIO or more simple
move-instruction sequences, we will do a clrmem or libcall instead. */ move-instruction sequences, we will do a clrmem or libcall instead. */
#define CLEAR_RATIO(speed) ((speed) ? MIN (6, ix86_cost->move_ratio) : 2) #define CLEAR_RATIO(speed) ((speed) ? ix86_cost->clear_ratio : 2)
/* Define if shifts truncate the shift count which implies one can /* Define if shifts truncate the shift count which implies one can
omit a sign-extension or zero-extension of a shift count. omit a sign-extension or zero-extension of a shift count.
......
...@@ -81,6 +81,7 @@ struct processor_costs ix86_size_cost = {/* costs for tuning for size */ ...@@ -81,6 +81,7 @@ struct processor_costs ix86_size_cost = {/* costs for tuning for size */
COSTS_N_BYTES (3), /* cost of movzx */ COSTS_N_BYTES (3), /* cost of movzx */
0, /* "large" insn */ 0, /* "large" insn */
2, /* MOVE_RATIO */ 2, /* MOVE_RATIO */
2, /* CLEAR_RATIO */
{2, 2, 2}, /* cost of loading integer registers {2, 2, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -185,6 +186,7 @@ struct processor_costs i386_cost = { /* 386 specific costs */ ...@@ -185,6 +186,7 @@ struct processor_costs i386_cost = { /* 386 specific costs */
COSTS_N_INSNS (2), /* cost of movzx */ COSTS_N_INSNS (2), /* cost of movzx */
15, /* "large" insn */ 15, /* "large" insn */
3, /* MOVE_RATIO */ 3, /* MOVE_RATIO */
3, /* CLEAR_RATIO */
{2, 4, 2}, /* cost of loading integer registers {2, 4, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -286,6 +288,7 @@ struct processor_costs i486_cost = { /* 486 specific costs */ ...@@ -286,6 +288,7 @@ struct processor_costs i486_cost = { /* 486 specific costs */
COSTS_N_INSNS (2), /* cost of movzx */ COSTS_N_INSNS (2), /* cost of movzx */
15, /* "large" insn */ 15, /* "large" insn */
3, /* MOVE_RATIO */ 3, /* MOVE_RATIO */
3, /* CLEAR_RATIO */
{2, 4, 2}, /* cost of loading integer registers {2, 4, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -389,6 +392,7 @@ struct processor_costs pentium_cost = { ...@@ -389,6 +392,7 @@ struct processor_costs pentium_cost = {
COSTS_N_INSNS (2), /* cost of movzx */ COSTS_N_INSNS (2), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
6, /* MOVE_RATIO */ 6, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{2, 4, 2}, /* cost of loading integer registers {2, 4, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -483,6 +487,7 @@ struct processor_costs lakemont_cost = { ...@@ -483,6 +487,7 @@ struct processor_costs lakemont_cost = {
COSTS_N_INSNS (2), /* cost of movzx */ COSTS_N_INSNS (2), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{2, 4, 2}, /* cost of loading integer registers {2, 4, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -592,6 +597,7 @@ struct processor_costs pentiumpro_cost = { ...@@ -592,6 +597,7 @@ struct processor_costs pentiumpro_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
6, /* MOVE_RATIO */ 6, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 4, 4}, /* cost of loading integer registers {4, 4, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -692,6 +698,7 @@ struct processor_costs geode_cost = { ...@@ -692,6 +698,7 @@ struct processor_costs geode_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
4, /* MOVE_RATIO */ 4, /* MOVE_RATIO */
4, /* CLEAR_RATIO */
{2, 2, 2}, /* cost of loading integer registers {2, 2, 2}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -792,6 +799,7 @@ struct processor_costs k6_cost = { ...@@ -792,6 +799,7 @@ struct processor_costs k6_cost = {
COSTS_N_INSNS (2), /* cost of movzx */ COSTS_N_INSNS (2), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
4, /* MOVE_RATIO */ 4, /* MOVE_RATIO */
4, /* CLEAR_RATIO */
{4, 5, 4}, /* cost of loading integer registers {4, 5, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -898,6 +906,7 @@ struct processor_costs athlon_cost = { ...@@ -898,6 +906,7 @@ struct processor_costs athlon_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{3, 4, 3}, /* cost of loading integer registers {3, 4, 3}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1006,6 +1015,7 @@ struct processor_costs k8_cost = { ...@@ -1006,6 +1015,7 @@ struct processor_costs k8_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{3, 4, 3}, /* cost of loading integer registers {3, 4, 3}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1127,6 +1137,7 @@ struct processor_costs amdfam10_cost = { ...@@ -1127,6 +1137,7 @@ struct processor_costs amdfam10_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{3, 4, 3}, /* cost of loading integer registers {3, 4, 3}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1240,6 +1251,7 @@ const struct processor_costs bdver_cost = { ...@@ -1240,6 +1251,7 @@ const struct processor_costs bdver_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{8, 8, 8}, /* cost of loading integer registers {8, 8, 8}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1364,6 +1376,7 @@ struct processor_costs znver1_cost = { ...@@ -1364,6 +1376,7 @@ struct processor_costs znver1_cost = {
COSTS_N_INSNS (1), /* cost of movzx. */ COSTS_N_INSNS (1), /* cost of movzx. */
8, /* "large" insn. */ 8, /* "large" insn. */
9, /* MOVE_RATIO. */ 9, /* MOVE_RATIO. */
6, /* CLEAR_RATIO */
{6, 6, 6}, /* cost of loading integer registers {6, 6, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1503,6 +1516,7 @@ struct processor_costs znver2_cost = { ...@@ -1503,6 +1516,7 @@ struct processor_costs znver2_cost = {
COSTS_N_INSNS (1), /* cost of movzx. */ COSTS_N_INSNS (1), /* cost of movzx. */
8, /* "large" insn. */ 8, /* "large" insn. */
9, /* MOVE_RATIO. */ 9, /* MOVE_RATIO. */
6, /* CLEAR_RATIO */
{6, 6, 6}, /* cost of loading integer registers {6, 6, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1635,6 +1649,7 @@ struct processor_costs skylake_cost = { ...@@ -1635,6 +1649,7 @@ struct processor_costs skylake_cost = {
COSTS_N_INSNS (0), /* cost of movzx */ COSTS_N_INSNS (0), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 4, 4}, /* cost of loading integer registers {4, 4, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1740,6 +1755,7 @@ const struct processor_costs btver1_cost = { ...@@ -1740,6 +1755,7 @@ const struct processor_costs btver1_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{6, 8, 6}, /* cost of loading integer registers {6, 8, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1843,6 +1859,7 @@ const struct processor_costs btver2_cost = { ...@@ -1843,6 +1859,7 @@ const struct processor_costs btver2_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
9, /* MOVE_RATIO */ 9, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{8, 8, 6}, /* cost of loading integer registers {8, 8, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -1945,6 +1962,7 @@ struct processor_costs pentium4_cost = { ...@@ -1945,6 +1962,7 @@ struct processor_costs pentium4_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
16, /* "large" insn */ 16, /* "large" insn */
6, /* MOVE_RATIO */ 6, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 5, 4}, /* cost of loading integer registers {4, 5, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2050,6 +2068,7 @@ struct processor_costs nocona_cost = { ...@@ -2050,6 +2068,7 @@ struct processor_costs nocona_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
16, /* "large" insn */ 16, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 4, 4}, /* cost of loading integer registers {4, 4, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2153,6 +2172,7 @@ struct processor_costs atom_cost = { ...@@ -2153,6 +2172,7 @@ struct processor_costs atom_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{6, 6, 6}, /* cost of loading integer registers {6, 6, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2256,6 +2276,7 @@ struct processor_costs slm_cost = { ...@@ -2256,6 +2276,7 @@ struct processor_costs slm_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{8, 8, 8}, /* cost of loading integer registers {8, 8, 8}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2359,6 +2380,7 @@ struct processor_costs intel_cost = { ...@@ -2359,6 +2380,7 @@ struct processor_costs intel_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 4, 4}, /* cost of loading integer registers {4, 4, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2469,6 +2491,7 @@ struct processor_costs generic_cost = { ...@@ -2469,6 +2491,7 @@ struct processor_costs generic_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{6, 6, 6}, /* cost of loading integer registers {6, 6, 6}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
...@@ -2585,6 +2608,7 @@ struct processor_costs core_cost = { ...@@ -2585,6 +2608,7 @@ struct processor_costs core_cost = {
COSTS_N_INSNS (1), /* cost of movzx */ COSTS_N_INSNS (1), /* cost of movzx */
8, /* "large" insn */ 8, /* "large" insn */
17, /* MOVE_RATIO */ 17, /* MOVE_RATIO */
6, /* CLEAR_RATIO */
{4, 4, 4}, /* cost of loading integer registers {4, 4, 4}, /* cost of loading integer registers
in QImode, HImode and SImode. in QImode, HImode and SImode.
Relative to reg-reg move (2). */ Relative to reg-reg move (2). */
......
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