aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-14 15:06:34 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-14 15:06:34 +0000
commit2df4150075c03f8a292c40afd3bb25febb673578 (patch)
treeb1d63cf6e91fb986619e29ab836fbd5b19d2b85e /gcc
parent1c84a2d25ecd4c03dde745f36a4762dd45f97c85 (diff)
downloadgcc-2df4150075c03f8a292c40afd3bb25febb673578.zip
gcc-2df4150075c03f8a292c40afd3bb25febb673578.tar.gz
gcc-2df4150075c03f8a292c40afd3bb25febb673578.tar.bz2
Make less use of get_same_sized_vectype
Some callers of get_same_sized_vectype were dealing with operands that are constant or defined externally, and so have no STMT_VINFO_VECTYPE available. Under the current model, using get_same_sized_vectype for that case is equivalent to using get_vectype_for_scalar_type, since get_vectype_for_scalar_type always returns vectors of the same size, once a size is fixed. Using get_vectype_for_scalar_type is arguably more obvious though: if we're using the same scalar type as we would for internal definitions, we should use the same vector type too. (Constant and external definitions sometimes let us change the original scalar type to a "nicer" scalar type, but that isn't what's happening here.) This is a prerequisite to supporting multiple vector sizes in the same vec_info. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-stmts.c (vectorizable_call): If an operand is constant or external, use get_vectype_for_scalar_type rather than get_same_sized_vectype to get its vector type. (vectorizable_conversion, vectorizable_shift): Likewise. (vectorizable_operation): Likewise. From-SVN: r278238
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-vect-stmts.c26
2 files changed, 21 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bd9eeec..28baebe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
+ * tree-vect-stmts.c (vectorizable_call): If an operand is
+ constant or external, use get_vectype_for_scalar_type
+ rather than get_same_sized_vectype to get its vector type.
+ (vectorizable_conversion, vectorizable_shift): Likewise.
+ (vectorizable_operation): Likewise.
+
+2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
+
* tree-vectorizer.h (vec_info::vector_size): Replace with...
(vec_info::vector_mode): ...this new field.
* tree-vect-loop.c (vect_update_vf_for_slp): Update accordingly.
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 43b2b0f..b7fff78 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3295,10 +3295,10 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
return false;
}
}
- /* If all arguments are external or constant defs use a vector type with
- the same size as the output vector type. */
+ /* If all arguments are external or constant defs, infer the vector type
+ from the scalar type. */
if (!vectype_in)
- vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+ vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type);
if (vec_stmt)
gcc_assert (vectype_in);
if (!vectype_in)
@@ -4787,10 +4787,10 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
}
}
- /* If op0 is an external or constant defs use a vector type of
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype_in)
- vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+ vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type);
if (vec_stmt)
gcc_assert (vectype_in);
if (!vectype_in)
@@ -5586,10 +5586,10 @@ vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
"use not simple.\n");
return false;
}
- /* If op0 is an external or constant def use a vector type with
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype)
- vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op0));
if (vec_stmt)
gcc_assert (vectype);
if (!vectype)
@@ -5688,7 +5688,7 @@ vectorizable_shift (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
"vector/vector shift/rotate found.\n");
if (!op1_vectype)
- op1_vectype = get_same_sized_vectype (TREE_TYPE (op1), vectype_out);
+ op1_vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op1));
incompatible_op1_vectype_p
= (op1_vectype == NULL_TREE
|| maybe_ne (TYPE_VECTOR_SUBPARTS (op1_vectype),
@@ -6019,8 +6019,8 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
"use not simple.\n");
return false;
}
- /* If op0 is an external or constant def use a vector type with
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype)
{
/* For boolean type we cannot determine vectype by
@@ -6040,7 +6040,7 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vectype = vectype_out;
}
else
- vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op0));
}
if (vec_stmt)
gcc_assert (vectype);