poly_int: vector_alignment_reachable_p
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 3 Jan 2018 07:15:41 +0000 (07:15 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 3 Jan 2018 07:15:41 +0000 (07:15 +0000)
This patch makes vector_alignment_reachable_p cope with variable-length
vectors.

2018-01-03  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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256132

gcc/ChangeLog
gcc/tree-vect-data-refs.c

index 39f3a91d24d3edd2c47c4f0aad355bb4330e70b8..e42270c40195b3f149472774c5dcaa6b83dcfa8b 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
+       number of units as polynomial.
+
 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index 02a32950ee34fc12a42a0c7b759c06a3555b6cf8..2e02be5df7fada831d1fa4253a6921cd8d3d25dc 100644 (file)
@@ -1154,16 +1154,17 @@ vector_alignment_reachable_p (struct data_reference *dr)
         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;
     }