aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-22 16:26:43 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-22 16:26:43 +0000
commit20bdc473ebd7176544e0c8cdf87750adc6f44a97 (patch)
tree3f0a8db11d05c48f085d0206443df458f655ad52 /gcc
parentdce04e57faaa33c1da286effc97943f5c9924691 (diff)
downloadgcc-20bdc473ebd7176544e0c8cdf87750adc6f44a97.zip
gcc-20bdc473ebd7176544e0c8cdf87750adc6f44a97.tar.gz
gcc-20bdc473ebd7176544e0c8cdf87750adc6f44a97.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-vect-data-refs.c11
-rw-r--r--gcc/tree-vectorizer.h13
3 files changed, 25 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bbef1ef..43e885b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index cab2f2f..175052a 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -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));
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index d6753ff..5d273ca 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -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;