public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end slp: elide intermediate nodes for complex add and avoid truncate
@ 2021-01-14 10:20 Tamar Christina
  2021-01-14 14:06 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2021-01-14 10:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther

[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]

Hi All,

This applies the same feedback received for MUL and the rest to
ADD which was already committed.  In short it elides the intermediate
nodes vec and avoids the use of truncate on the SLP child.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	* tree-vect-slp-patterns.c (complex_add_pattern::build):

--- inline copy of patch -- 
diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
index be066b08310b72320fdbeb88a6b2969151f73cdc..e9f70958fdc32427ab0e1cceadfed41dfa091b47 100644
--- a/gcc/tree-vect-slp-patterns.c
+++ b/gcc/tree-vect-slp-patterns.c
@@ -645,23 +645,21 @@ class complex_add_pattern : public complex_pattern
 void
 complex_add_pattern::build (vec_info *vinfo)
 {
-  auto_vec<slp_tree> nodes;
+  SLP_TREE_CHILDREN (*this->m_node).reserve_exact (2);
+
   slp_tree node = this->m_ops[0];
   vec<slp_tree> children = SLP_TREE_CHILDREN (node);
 
   /* First re-arrange the children.  */
-  nodes.create (children.length ());
-  nodes.quick_push (children[0]);
-  nodes.quick_push (vect_build_swap_evenodd_node (children[1]));
+  SLP_TREE_CHILDREN (*this->m_node)[0] = children[0];
+  SLP_TREE_CHILDREN (*this->m_node)[1] =
+    vect_build_swap_evenodd_node (children[1]);
 
-  SLP_TREE_REF_COUNT (nodes[0])++;
-  SLP_TREE_REF_COUNT (nodes[1])++;
+  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[0])++;
+  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[1])++;
   vect_free_slp_tree (this->m_ops[0]);
   vect_free_slp_tree (this->m_ops[1]);
 
-  SLP_TREE_CHILDREN (*this->m_node).truncate (0);
-  SLP_TREE_CHILDREN (*this->m_node).safe_splice (nodes);
-
   complex_pattern::build (vinfo);
 }
 


-- 

[-- Attachment #2: rb14027.patch --]
[-- Type: text/x-diff, Size: 1307 bytes --]

diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
index be066b08310b72320fdbeb88a6b2969151f73cdc..e9f70958fdc32427ab0e1cceadfed41dfa091b47 100644
--- a/gcc/tree-vect-slp-patterns.c
+++ b/gcc/tree-vect-slp-patterns.c
@@ -645,23 +645,21 @@ class complex_add_pattern : public complex_pattern
 void
 complex_add_pattern::build (vec_info *vinfo)
 {
-  auto_vec<slp_tree> nodes;
+  SLP_TREE_CHILDREN (*this->m_node).reserve_exact (2);
+
   slp_tree node = this->m_ops[0];
   vec<slp_tree> children = SLP_TREE_CHILDREN (node);
 
   /* First re-arrange the children.  */
-  nodes.create (children.length ());
-  nodes.quick_push (children[0]);
-  nodes.quick_push (vect_build_swap_evenodd_node (children[1]));
+  SLP_TREE_CHILDREN (*this->m_node)[0] = children[0];
+  SLP_TREE_CHILDREN (*this->m_node)[1] =
+    vect_build_swap_evenodd_node (children[1]);
 
-  SLP_TREE_REF_COUNT (nodes[0])++;
-  SLP_TREE_REF_COUNT (nodes[1])++;
+  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[0])++;
+  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[1])++;
   vect_free_slp_tree (this->m_ops[0]);
   vect_free_slp_tree (this->m_ops[1]);
 
-  SLP_TREE_CHILDREN (*this->m_node).truncate (0);
-  SLP_TREE_CHILDREN (*this->m_node).safe_splice (nodes);
-
   complex_pattern::build (vinfo);
 }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH]middle-end slp: elide intermediate nodes for complex add and avoid truncate
  2021-01-14 10:20 [PATCH]middle-end slp: elide intermediate nodes for complex add and avoid truncate Tamar Christina
@ 2021-01-14 14:06 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2021-01-14 14:06 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd

On Thu, 14 Jan 2021, Tamar Christina wrote:

> Hi All,
> 
> This applies the same feedback received for MUL and the rest to
> ADD which was already committed.  In short it elides the intermediate
> nodes vec and avoids the use of truncate on the SLP child.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?

OK.

Thanks,
Richard.

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	* tree-vect-slp-patterns.c (complex_add_pattern::build):
> 
> --- inline copy of patch -- 
> diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
> index be066b08310b72320fdbeb88a6b2969151f73cdc..e9f70958fdc32427ab0e1cceadfed41dfa091b47 100644
> --- a/gcc/tree-vect-slp-patterns.c
> +++ b/gcc/tree-vect-slp-patterns.c
> @@ -645,23 +645,21 @@ class complex_add_pattern : public complex_pattern
>  void
>  complex_add_pattern::build (vec_info *vinfo)
>  {
> -  auto_vec<slp_tree> nodes;
> +  SLP_TREE_CHILDREN (*this->m_node).reserve_exact (2);
> +
>    slp_tree node = this->m_ops[0];
>    vec<slp_tree> children = SLP_TREE_CHILDREN (node);
>  
>    /* First re-arrange the children.  */
> -  nodes.create (children.length ());
> -  nodes.quick_push (children[0]);
> -  nodes.quick_push (vect_build_swap_evenodd_node (children[1]));
> +  SLP_TREE_CHILDREN (*this->m_node)[0] = children[0];
> +  SLP_TREE_CHILDREN (*this->m_node)[1] =
> +    vect_build_swap_evenodd_node (children[1]);
>  
> -  SLP_TREE_REF_COUNT (nodes[0])++;
> -  SLP_TREE_REF_COUNT (nodes[1])++;
> +  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[0])++;
> +  SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (*this->m_node)[1])++;
>    vect_free_slp_tree (this->m_ops[0]);
>    vect_free_slp_tree (this->m_ops[1]);
>  
> -  SLP_TREE_CHILDREN (*this->m_node).truncate (0);
> -  SLP_TREE_CHILDREN (*this->m_node).safe_splice (nodes);
> -
>    complex_pattern::build (vinfo);
>  }
>  
> 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-14 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 10:20 [PATCH]middle-end slp: elide intermediate nodes for complex add and avoid truncate Tamar Christina
2021-01-14 14:06 ` Richard Biener

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).