diff mbox series

[082/nnn] poly_int: omp-simd-clone.c

Message ID 871slthiqz.fsf@linaro.org
State New
Headers show
Series [082/nnn] poly_int: omp-simd-clone.c | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:33 p.m. UTC
This patch adds a wrapper around TYPE_VECTOR_SUBPARTS for omp-simd-clone.c.
Supporting SIMD clones for variable-length vectors is post GCC8 work.


2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* omp-simd-clone.c (simd_clone_subparts): New function.
	(simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
	(ipa_simd_modify_function_body): Likewise.

Comments

Jeff Law Nov. 28, 2017, 4:33 p.m. UTC | #1
On 10/23/2017 11:33 AM, Richard Sandiford wrote:
> This patch adds a wrapper around TYPE_VECTOR_SUBPARTS for omp-simd-clone.c.
> Supporting SIMD clones for variable-length vectors is post GCC8 work.
> 
> 
> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* omp-simd-clone.c (simd_clone_subparts): New function.
> 	(simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
> 	(ipa_simd_modify_function_body): Likewise.
OK.
jeff
diff mbox series

Patch

Index: gcc/omp-simd-clone.c
===================================================================
--- gcc/omp-simd-clone.c	2017-08-30 12:19:19.716220030 +0100
+++ gcc/omp-simd-clone.c	2017-10-23 17:22:47.947648317 +0100
@@ -51,6 +51,15 @@  Software Foundation; either version 3, o
 #include "stringpool.h"
 #include "attribs.h"
 
+/* Return the number of elements in vector type VECTYPE, which is associated
+   with a SIMD clone.  At present these always have a constant length.  */
+
+static unsigned HOST_WIDE_INT
+simd_clone_subparts (tree vectype)
+{
+  return TYPE_VECTOR_SUBPARTS (vectype);
+}
+
 /* Allocate a fresh `simd_clone' and return it.  NARGS is the number
    of arguments to reserve space for.  */
 
@@ -770,7 +779,7 @@  simd_clone_init_simd_arrays (struct cgra
 	    }
 	  continue;
 	}
-      if (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg)) == node->simdclone->simdlen)
+      if (simd_clone_subparts (TREE_TYPE (arg)) == node->simdclone->simdlen)
 	{
 	  tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
 	  tree ptr = build_fold_addr_expr (array);
@@ -781,7 +790,7 @@  simd_clone_init_simd_arrays (struct cgra
 	}
       else
 	{
-	  unsigned int simdlen = TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg));
+	  unsigned int simdlen = simd_clone_subparts (TREE_TYPE (arg));
 	  tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
 	  for (k = 0; k < node->simdclone->simdlen; k += simdlen)
 	    {
@@ -927,8 +936,8 @@  ipa_simd_modify_function_body (struct cg
 		  iter,
 		  NULL_TREE, NULL_TREE);
       if (adjustments[j].op == IPA_PARM_OP_NONE
-	  && TYPE_VECTOR_SUBPARTS (vectype) < node->simdclone->simdlen)
-	j += node->simdclone->simdlen / TYPE_VECTOR_SUBPARTS (vectype) - 1;
+	  && simd_clone_subparts (vectype) < node->simdclone->simdlen)
+	j += node->simdclone->simdlen / simd_clone_subparts (vectype) - 1;
     }
 
   l = adjustments.length ();