[gcc/devel/ranger] Use get_related_vectype_for_scalar_type for reduction indices

Aldy Hernandez aldyh@gcc.gnu.org
Wed Jun 17 17:48:47 GMT 2020


https://gcc.gnu.org/g:d29c7f605fc6b531eaf351bf5909e7c551fc6b9e

commit d29c7f605fc6b531eaf351bf5909e7c551fc6b9e
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Fri Jan 10 14:56:31 2020 +0000

    Use get_related_vectype_for_scalar_type for reduction indices
    
    The related_vector_mode series missed this case in
    vect_create_epilog_for_reduction, where we want to create the
    unsigned integer equivalent of another vector.  Without it we
    could mix SVE and Advanced SIMD vectors in the same operation.
    
    This showed up on existing tests when testing with fixed-length
    -msve-vector-bits=128.
    
    2020-01-10  Richard Sandiford  <richard.sandiford@arm.com>
    
    gcc/
            * tree-vect-loop.c (vect_create_epilog_for_reduction): Use
            get_related_vectype_for_scalar_type rather than build_vector_type
            to create the index type for a conditional reduction.
    
    From-SVN: r280112

Diff:
---
 gcc/ChangeLog        | 6 ++++++
 gcc/tree-vect-loop.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28564f723e1..21dd1aa29c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-10  Richard Sandiford  <richard.sandiford@arm.com>
+
+	* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
+	get_related_vectype_for_scalar_type rather than build_vector_type
+	to create the index type for a conditional reduction.
+
 2020-01-10  Richard Sandiford  <richard.sandiford@arm.com>
 
 	* tree-vect-loop.c (update_epilogue_loop_vinfo): Update DR_REF
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 1fa3ba6d932..faf816116de 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4566,8 +4566,9 @@ vect_create_epilog_for_reduction (stmt_vec_info stmt_info,
       int scalar_precision
 	= GET_MODE_PRECISION (SCALAR_TYPE_MODE (TREE_TYPE (vectype)));
       tree cr_index_scalar_type = make_unsigned_type (scalar_precision);
-      tree cr_index_vector_type = build_vector_type
-	(cr_index_scalar_type, TYPE_VECTOR_SUBPARTS (vectype));
+      tree cr_index_vector_type = get_related_vectype_for_scalar_type
+	(TYPE_MODE (vectype), cr_index_scalar_type,
+	 TYPE_VECTOR_SUBPARTS (vectype));
 
       /* First we create a simple vector induction variable which starts
 	 with the values {1,2,3,...} (SERIES_VECT) and increments by the


More information about the Gcc-cvs mailing list