Commit 20bdc473 by Richard Sandiford Committed by Richard Sandiford

Add a vect_get_scalar_dr_size helper function

This patch adds a helper function for getting the number of bytes
accessed by an unvectorised data reference, which helps when general
modes have a variable size.

2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* 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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r253099
parent dce04e57
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
......@@ -955,7 +955,6 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
return true;
}
/* Function vect_update_misalignment_for_peel.
Sets DR's misalignment
- to 0 if it has the same alignment as DR_PEEL,
......@@ -975,8 +974,8 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
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));
......@@ -1664,8 +1663,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
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);
......@@ -1937,8 +1935,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
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));
}
......
......@@ -1095,6 +1095,19 @@ vect_get_num_copies (loop_vec_info loop_vinfo, tree vectype)
/ 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment