aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-07-31 14:23:57 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-07-31 14:23:57 +0000
commitbeb456c375ea71d57e35400e9b7107e09e996965 (patch)
treec6abc11910ddc42f2e70b359901386fc2adcb87b /gcc/tree-vect-data-refs.c
parent95c68311b61f6bbb013d0eb2e4403f01c76bf622 (diff)
downloadgcc-beb456c375ea71d57e35400e9b7107e09e996965.zip
gcc-beb456c375ea71d57e35400e9b7107e09e996965.tar.gz
gcc-beb456c375ea71d57e35400e9b7107e09e996965.tar.bz2
[26/46] Make more use of dyn_cast in tree-vect*
If we use stmt_vec_infos to represent statements in the vectoriser, it's then more natural to use dyn_cast when processing the statement as an assignment, call, etc. This patch does that in a few more places. 2018-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-data-refs.c (vect_check_gather_scatter): Pass the gcall rather than the generic gimple stmt to gimple_call_internal_fn. (vect_get_smallest_scalar_type, can_group_stmts_p): Use dyn_cast to get gassigns and gcalls, rather than operating on generc gimple stmts. * tree-vect-stmts.c (exist_non_indexing_operands_for_use_p) (vect_mark_stmts_to_be_vectorized, vectorizable_store) (vectorizable_load, vect_analyze_stmt): Likewise. * tree-vect-loop.c (vectorizable_reduction): Likewise gphi. From-SVN: r263141
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 81d2a58..7cf9014 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -130,15 +130,16 @@ vect_get_smallest_scalar_type (gimple *stmt, HOST_WIDE_INT *lhs_size_unit,
lhs = rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type));
- if (is_gimple_assign (stmt)
- && (gimple_assign_cast_p (stmt)
- || gimple_assign_rhs_code (stmt) == DOT_PROD_EXPR
- || gimple_assign_rhs_code (stmt) == WIDEN_SUM_EXPR
- || gimple_assign_rhs_code (stmt) == WIDEN_MULT_EXPR
- || gimple_assign_rhs_code (stmt) == WIDEN_LSHIFT_EXPR
- || gimple_assign_rhs_code (stmt) == FLOAT_EXPR))
+ gassign *assign = dyn_cast <gassign *> (stmt);
+ if (assign
+ && (gimple_assign_cast_p (assign)
+ || gimple_assign_rhs_code (assign) == DOT_PROD_EXPR
+ || gimple_assign_rhs_code (assign) == WIDEN_SUM_EXPR
+ || gimple_assign_rhs_code (assign) == WIDEN_MULT_EXPR
+ || gimple_assign_rhs_code (assign) == WIDEN_LSHIFT_EXPR
+ || gimple_assign_rhs_code (assign) == FLOAT_EXPR))
{
- tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
+ tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (assign));
rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (rhs_type));
if (rhs < lhs)
@@ -2850,21 +2851,23 @@ can_group_stmts_p (gimple *stmt1, gimple *stmt2)
if (gimple_assign_single_p (stmt1))
return gimple_assign_single_p (stmt2);
- if (is_gimple_call (stmt1) && gimple_call_internal_p (stmt1))
+ gcall *call1 = dyn_cast <gcall *> (stmt1);
+ if (call1 && gimple_call_internal_p (call1))
{
/* Check for two masked loads or two masked stores. */
- if (!is_gimple_call (stmt2) || !gimple_call_internal_p (stmt2))
+ gcall *call2 = dyn_cast <gcall *> (stmt2);
+ if (!call2 || !gimple_call_internal_p (call2))
return false;
- internal_fn ifn = gimple_call_internal_fn (stmt1);
+ internal_fn ifn = gimple_call_internal_fn (call1);
if (ifn != IFN_MASK_LOAD && ifn != IFN_MASK_STORE)
return false;
- if (ifn != gimple_call_internal_fn (stmt2))
+ if (ifn != gimple_call_internal_fn (call2))
return false;
/* Check that the masks are the same. Cope with casts of masks,
like those created by build_mask_conversion. */
- tree mask1 = gimple_call_arg (stmt1, 2);
- tree mask2 = gimple_call_arg (stmt2, 2);
+ tree mask1 = gimple_call_arg (call1, 2);
+ tree mask2 = gimple_call_arg (call2, 2);
if (!operand_equal_p (mask1, mask2, 0))
{
mask1 = strip_conversion (mask1);
@@ -3665,7 +3668,7 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo,
gcall *call = dyn_cast <gcall *> (stmt);
if (call && gimple_call_internal_p (call))
{
- ifn = gimple_call_internal_fn (stmt);
+ ifn = gimple_call_internal_fn (call);
if (internal_gather_scatter_fn_p (ifn))
{
vect_describe_gather_scatter_call (call, info);