diff mbox series

[069/nnn] poly_int: vector_alignment_reachable_p

Message ID 87lgk1ixj4.fsf@linaro.org
State New
Headers show
Series [069/nnn] poly_int: vector_alignment_reachable_p | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:28 p.m. UTC
This patch makes vector_alignment_reachable_p cope with variable-length
vectors.


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

gcc/
	* tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
	number of units as polynomial.

Comments

Jeff Law Nov. 28, 2017, 4:46 p.m. UTC | #1
On 10/23/2017 11:28 AM, Richard Sandiford wrote:
> This patch makes vector_alignment_reachable_p cope with variable-length

> vectors.

> 

> 

> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>

> 	    Alan Hayward  <alan.hayward@arm.com>

> 	    David Sherwood  <david.sherwood@arm.com>

> 

> gcc/

> 	* tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the

> 	number of units as polynomial.


OK
jeff
diff mbox series

Patch

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	2017-10-23 17:22:26.571498977 +0100
+++ gcc/tree-vect-data-refs.c	2017-10-23 17:22:34.681024458 +0100
@@ -1153,16 +1153,17 @@  vector_alignment_reachable_p (struct dat
 	 the prolog loop ({VF - misalignment}), is a multiple of the
 	 number of the interleaved accesses.  */
       int elem_size, mis_in_elements;
-      int nelements = TYPE_VECTOR_SUBPARTS (vectype);
 
       /* FORNOW: handle only known alignment.  */
       if (!known_alignment_for_access_p (dr))
 	return false;
 
-      elem_size = GET_MODE_SIZE (TYPE_MODE (vectype)) / nelements;
+      poly_uint64 nelements = TYPE_VECTOR_SUBPARTS (vectype);
+      poly_uint64 vector_size = GET_MODE_SIZE (TYPE_MODE (vectype));
+      elem_size = vector_element_size (vector_size, nelements);
       mis_in_elements = DR_MISALIGNMENT (dr) / elem_size;
 
-      if ((nelements - mis_in_elements) % GROUP_SIZE (stmt_info))
+      if (!multiple_p (nelements - mis_in_elements, GROUP_SIZE (stmt_info)))
 	return false;
     }