public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2942] vect: Add extraction cost for slp reduc
@ 2021-08-17  9:21 Kewen Lin
  0 siblings, 0 replies; only message in thread
From: Kewen Lin @ 2021-08-17  9:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2e0d7f16da0897fb2eb83f5c1ffe67f0ad747e92

commit r12-2942-g2e0d7f16da0897fb2eb83f5c1ffe67f0ad747e92
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Aug 17 03:18:02 2021 -0500

    vect: Add extraction cost for slp reduc
    
    As Richi pointed out, currently for BB reductions we don't
    actually build a SLP node with IFN_REDUC_* information,
    ideally we may end up with that eventually.
    
    For now, it's costed as shuffles and reduc operations, it
    misses the cost of lane extraction.  This patch is to add
    one time of vec_to_scalar cost for lane extraction, it's to
    make the costings consistent and conservative for now.
    
    gcc/ChangeLog:
    
            * tree-vect-slp.c (vectorizable_bb_reduc_epilogue): Add the cost for
            value extraction.

Diff:
---
 gcc/tree-vect-slp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index d169bed8e94..4dcc70c5dd7 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4861,12 +4861,14 @@ vectorizable_bb_reduc_epilogue (slp_instance instance,
     return false;
 
   /* There's no way to cost a horizontal vector reduction via REDUC_FN so
-     cost log2 vector operations plus shuffles.  */
+     cost log2 vector operations plus shuffles and one extraction.  */
   unsigned steps = floor_log2 (vect_nunits_for_cost (vectype));
   record_stmt_cost (cost_vec, steps, vector_stmt, instance->root_stmts[0],
 		    vectype, 0, vect_body);
   record_stmt_cost (cost_vec, steps, vec_perm, instance->root_stmts[0],
 		    vectype, 0, vect_body);
+  record_stmt_cost (cost_vec, 1, vec_to_scalar, instance->root_stmts[0],
+		    vectype, 0, vect_body);
   return true;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-17  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  9:21 [gcc r12-2942] vect: Add extraction cost for slp reduc 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).