+2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
+ * tree-vectorizer.h (vect_get_scalar_dr_size): New function.
+ * tree-vect-data-refs.c (vect_update_misalignment_for_peel): Use it.
+ (vect_enhance_data_refs_alignment): Likewise.
+
2017-09-22 Richard Earnshaw <richard.earnshaw@arm.com>
* config/arm/parsecpu.awk (fatal): Note that we've encountered an
return true;
}
-
/* Function vect_update_misalignment_for_peel.
Sets DR's misalignment
- to 0 if it has the same alignment as DR_PEEL,
unsigned int i;
vec<dr_p> same_aligned_drs;
struct data_reference *current_dr;
- int dr_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr))));
- int dr_peel_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr_peel))));
+ int dr_size = vect_get_scalar_dr_size (dr);
+ int dr_peel_size = vect_get_scalar_dr_size (dr_peel);
stmt_vec_info stmt_info = vinfo_for_stmt (DR_STMT (dr));
stmt_vec_info peel_stmt_info = vinfo_for_stmt (DR_STMT (dr_peel));
vectype = STMT_VINFO_VECTYPE (stmt_info);
nelements = TYPE_VECTOR_SUBPARTS (vectype);
- mis = DR_MISALIGNMENT (dr) / GET_MODE_SIZE (TYPE_MODE (
- TREE_TYPE (DR_REF (dr))));
+ mis = DR_MISALIGNMENT (dr) / vect_get_scalar_dr_size (dr);
if (DR_MISALIGNMENT (dr) != 0)
npeel_tmp = (negative ? (mis - nelements)
: (nelements - mis)) & (nelements - 1);
updating DR_MISALIGNMENT values. The peeling factor is the
vectorization factor minus the misalignment as an element
count. */
- mis = DR_MISALIGNMENT (dr0);
- mis /= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr0))));
+ mis = DR_MISALIGNMENT (dr0) / vect_get_scalar_dr_size (dr0);
npeel = ((negative ? mis - nelements : nelements - mis)
& (nelements - 1));
}
/ TYPE_VECTOR_SUBPARTS (vectype));
}
+/* Return the size of the value accessed by unvectorized data reference DR.
+ This is only valid once STMT_VINFO_VECTYPE has been calculated for the
+ associated gimple statement, since that guarantees that DR accesses
+ either a scalar or a scalar equivalent. ("Scalar equivalent" here
+ includes things like V1SI, which can be vectorized in the same way
+ as a plain SI.) */
+
+inline unsigned int
+vect_get_scalar_dr_size (struct data_reference *dr)
+{
+ return tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr))));
+}
+
/* Source location */
extern source_location vect_location;