aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-07-06 08:13:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-07-06 08:13:49 +0000
commit134c85caeba541ff4fb4377fb12729073cbdfe41 (patch)
treea217ca5a0f098d0bb1ddba69195d254a7b18c348 /gcc/tree-vect-data-refs.c
parent071e8018fe67cabb165255ac88a165b80fadbcc7 (diff)
downloadgcc-134c85caeba541ff4fb4377fb12729073cbdfe41.zip
gcc-134c85caeba541ff4fb4377fb12729073cbdfe41.tar.gz
gcc-134c85caeba541ff4fb4377fb12729073cbdfe41.tar.bz2
[4/7] Add a gather_scatter_info structure
This patch just refactors the gather/scatter support so that all information is in a single structure, rather than separate variables. This reduces the number of arguments to a function added in patch 6. Tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ * tree-vectorizer.h (gather_scatter_info): New structure. (vect_check_gather_scatter): Return a bool rather than a decl. Replace return-by-pointer arguments with a single gather_scatter_info *. * tree-vect-data-refs.c (vect_check_gather_scatter): Likewise. (vect_analyze_data_refs): Update call accordingly. * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise. (vectorizable_mask_load_store): Likewise. Also record the offset dt and vectype in the gather_scatter_info. (vectorizable_store): Likewise. (vectorizable_load): Likewise. From-SVN: r238036
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 5ac34be..71155c9 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3187,12 +3187,12 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
return true;
}
-/* Check whether a non-affine read or write in stmt is suitable for gather load
- or scatter store and if so, return a builtin decl for that operation. */
+/* Return true if a non-affine read or write in STMT is suitable for a
+ gather load or scatter store. Describe the operation in *INFO if so. */
-tree
-vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
- tree *offp, int *scalep)
+bool
+vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo,
+ gather_scatter_info *info)
{
HOST_WIDE_INT scale = 1, pbitpos, pbitsize;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -3266,7 +3266,7 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
if (!expr_invariant_in_loop_p (loop, base))
{
if (!integer_zerop (off))
- return NULL_TREE;
+ return false;
off = base;
base = size_int (pbitpos / BITS_PER_UNIT);
}
@@ -3292,7 +3292,7 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
gimple *def_stmt = SSA_NAME_DEF_STMT (off);
if (expr_invariant_in_loop_p (loop, off))
- return NULL_TREE;
+ return false;
if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
break;
@@ -3304,7 +3304,7 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
else
{
if (get_gimple_rhs_class (TREE_CODE (off)) == GIMPLE_TERNARY_RHS)
- return NULL_TREE;
+ return false;
code = TREE_CODE (off);
extract_ops_from_tree (off, &code, &op0, &op1);
}
@@ -3379,7 +3379,7 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
defined in the loop, punt. */
if (TREE_CODE (off) != SSA_NAME
|| expr_invariant_in_loop_p (loop, off))
- return NULL_TREE;
+ return false;
if (offtype == NULL_TREE)
offtype = TREE_TYPE (off);
@@ -3392,15 +3392,15 @@ vect_check_gather_scatter (gimple *stmt, loop_vec_info loop_vinfo, tree *basep,
offtype, scale);
if (decl == NULL_TREE)
- return NULL_TREE;
-
- if (basep)
- *basep = base;
- if (offp)
- *offp = off;
- if (scalep)
- *scalep = scale;
- return decl;
+ return false;
+
+ info->decl = decl;
+ info->base = base;
+ info->offset = off;
+ info->offset_dt = vect_unknown_def_type;
+ info->offset_vectype = NULL_TREE;
+ info->scale = scale;
+ return true;
}
/* Function vect_analyze_data_refs.
@@ -3878,10 +3878,10 @@ again:
if (gatherscatter != SG_NONE)
{
- tree off;
+ gather_scatter_info gs_info;
if (!vect_check_gather_scatter (stmt, as_a <loop_vec_info> (vinfo),
- NULL, &off, NULL)
- || get_vectype_for_scalar_type (TREE_TYPE (off)) == NULL_TREE)
+ &gs_info)
+ || !get_vectype_for_scalar_type (TREE_TYPE (gs_info.offset)))
{
STMT_VINFO_DATA_REF (stmt_info) = NULL;
free_data_ref (dr);