public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-705] rs6000: Guard density_test only for vector version
@ 2021-05-11 6:06 Kewen Lin
0 siblings, 0 replies; only message in thread
From: Kewen Lin @ 2021-05-11 6:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1866182f6cf338880c68225d9de571b787b6abcd
commit r12-705-g1866182f6cf338880c68225d9de571b787b6abcd
Author: Kewen Lin <linkw@linux.ibm.com>
Date: Mon May 10 23:01:15 2021 -0500
rs6000: Guard density_test only for vector version
This patch teaches rs6000_density_test to only care about the vector
version cost calculation and early return when calculating the single
scalar iteration cost.
Bootstrapped/regtested on powerpc64le-linux-gnu P9.
gcc/ChangeLog:
* config/rs6000/rs6000.c (struct rs6000_cost_data): New member
costing_for_scalar.
(rs6000_density_test): Early return if costing_for_scalar is true.
(rs6000_init_cost): Init costing_for_scalar of rs6000_cost_data.
Diff:
---
gcc/config/rs6000/rs6000.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1ef5149ad2e..d1b76f6ec41 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5238,6 +5238,8 @@ typedef struct _rs6000_cost_data
/* For each vectorized loop, this var holds TRUE iff a non-memory vector
instruction is needed by the vectorization. */
bool vect_nonmem;
+ /* Indicates this is costing for the scalar version of a loop or block. */
+ bool costing_for_scalar;
} rs6000_cost_data;
/* Test for likely overcommitment of vector hardware resources. If a
@@ -5259,6 +5261,12 @@ rs6000_density_test (rs6000_cost_data *data)
int vec_cost = data->cost[vect_body], not_vec_cost = 0;
int i, density_pct;
+ /* This density test only cares about the cost of vector version of the
+ loop, so immediately return if we are passed costing for the scalar
+ version (namely computing single scalar iteration cost). */
+ if (data->costing_for_scalar)
+ return;
+
for (i = 0; i < nbbs; i++)
{
basic_block bb = bbs[i];
@@ -5296,7 +5304,7 @@ rs6000_density_test (rs6000_cost_data *data)
/* Implement targetm.vectorize.init_cost. */
static void *
-rs6000_init_cost (struct loop *loop_info, bool)
+rs6000_init_cost (struct loop *loop_info, bool costing_for_scalar)
{
rs6000_cost_data *data = XNEW (struct _rs6000_cost_data);
data->loop_info = loop_info;
@@ -5304,6 +5312,7 @@ rs6000_init_cost (struct loop *loop_info, bool)
data->cost[vect_body] = 0;
data->cost[vect_epilogue] = 0;
data->vect_nonmem = false;
+ data->costing_for_scalar = costing_for_scalar;
return data;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-11 6:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 6:06 [gcc r12-705] rs6000: Guard density_test only for vector version Kewen Lin
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).