aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKewen Lin <linkw@gcc.gnu.org>2020-05-07 13:52:52 -0400
committerJeff Law <law@torsion.usersys.redhat.com>2020-05-07 13:52:52 -0400
commit3807f286eff75cb0e4af924c3ee9e02add23e12e (patch)
tree9bc8631ea4e243ea87cdb0fcc92798473a8ddc35 /gcc
parent41081235df0e32d9bfc3fe4169af4f1af4b823af (diff)
downloadgcc-3807f286eff75cb0e4af924c3ee9e02add23e12e.zip
gcc-3807f286eff75cb0e4af924c3ee9e02add23e12e.tar.gz
gcc-3807f286eff75cb0e4af924c3ee9e02add23e12e.tar.bz2
Check alignment for no peeling gaps handling
* gcc/tree-vect-stmts.c (vectorizable_load): Check alignment to avoid redundant half vector handlings for no peeling gaps.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-vect-stmts.c22
2 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 176b0de..986da64 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-07 Kewen Lin <linkw@gcc.gnu.org>
+
+ * tree-vect-stmts.c (vectorizable_load): Check alignment to avoid
+ redundant half vector handlings for no peeling gaps.
+
2020-05-07 Giuliano Belinassi <giuliano.belinassi@usp.br>
* tree-ssa-operands.c (operands_scanner): New class.
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 3828587..2349d31 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -9628,6 +9628,12 @@ vectorizable_load (vec_info *vinfo,
{
tree ltype = vectype;
tree new_vtype = NULL_TREE;
+ unsigned HOST_WIDE_INT gap
+ = DR_GROUP_GAP (first_stmt_info);
+ unsigned int vect_align
+ = vect_known_alignment_in_bytes (first_dr_info);
+ unsigned int scalar_dr_size
+ = vect_get_scalar_dr_size (first_dr_info);
/* If there's no peeling for gaps but we have a gap
with slp loads then load the lower half of the
vector only. See get_group_load_store_type for
@@ -9635,11 +9641,10 @@ vectorizable_load (vec_info *vinfo,
if (slp
&& loop_vinfo
&& !LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
- && DR_GROUP_GAP (first_stmt_info) != 0
- && known_eq (nunits,
- (group_size
- - DR_GROUP_GAP (first_stmt_info)) * 2)
- && known_eq (nunits, group_size))
+ && gap != 0
+ && known_eq (nunits, (group_size - gap) * 2)
+ && known_eq (nunits, group_size)
+ && gap >= (vect_align / scalar_dr_size))
{
tree half_vtype;
new_vtype
@@ -9654,10 +9659,9 @@ vectorizable_load (vec_info *vinfo,
if (ltype != vectype
&& memory_access_type == VMAT_CONTIGUOUS_REVERSE)
{
- unsigned HOST_WIDE_INT gap
- = DR_GROUP_GAP (first_stmt_info);
- gap *= tree_to_uhwi (TYPE_SIZE_UNIT (elem_type));
- tree gapcst = build_int_cst (ref_type, gap);
+ unsigned HOST_WIDE_INT gap_offset
+ = gap * tree_to_uhwi (TYPE_SIZE_UNIT (elem_type));
+ tree gapcst = build_int_cst (ref_type, gap_offset);
offset = size_binop (PLUS_EXPR, offset, gapcst);
}
data_ref