From 93bd0213885739a1073f8c98911f8a00c0eb5597 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 18 Oct 2021 15:55:22 +0200 Subject: Refactor vect_supportable_dr_alignment This refactors vect_supportable_dr_alignment to get the misalignment as input parameter which allows us to elide modifying/restoring of DR_MISALIGNMENT during alignment peeling analysis which eventually makes it more straight-forward to split out the negative step handling. 2021-10-19 Richard Biener * tree-vectorizer.h (vect_supportable_dr_alignment): Add misalignment parameter. * tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Do not change DR_MISALIGNMENT in place, instead pass the adjusted misalignment to vect_supportable_dr_alignment. (vect_peeling_supportable): Likewise. (vect_peeling_hash_get_lowest_cost): Adjust. (vect_enhance_data_refs_alignment): Likewise. (vect_vfa_access_size): Likewise. (vect_supportable_dr_alignment): Add misalignment parameter and simplify. * tree-vect-stmts.c (get_negative_load_store_type): Adjust. (get_group_load_store_type): Likewise. (get_load_store_type): Likewise. --- gcc/tree-vect-stmts.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'gcc/tree-vect-stmts.c') diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index afc3ef1..9cbc1af 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1986,8 +1986,9 @@ get_negative_load_store_type (vec_info *vinfo, return VMAT_ELEMENTWISE; } - alignment_support_scheme = vect_supportable_dr_alignment (vinfo, dr_info, - vectype); + int misalignment = dr_misalignment (dr_info, vectype); + alignment_support_scheme + = vect_supportable_dr_alignment (vinfo, dr_info, vectype, misalignment); if (alignment_support_scheme != dr_aligned && alignment_support_scheme != dr_unaligned_supported) { @@ -2184,15 +2185,15 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info, can do half-vector operations avoid the epilogue peeling by simply loading half of the vector only. Usually the construction with an upper zero half will be elided. */ - dr_alignment_support alignment_support_scheme; + dr_alignment_support alss; + int misalign = dr_misalignment (first_dr_info, vectype); tree half_vtype; if (overrun_p && !masked_p - && (((alignment_support_scheme - = vect_supportable_dr_alignment (vinfo, first_dr_info, - vectype))) + && (((alss = vect_supportable_dr_alignment (vinfo, first_dr_info, + vectype, misalign))) == dr_aligned - || alignment_support_scheme == dr_unaligned_supported) + || alss == dr_unaligned_supported) && known_eq (nunits, (group_size - gap) * 2) && known_eq (nunits, group_size) && (vector_vector_composition_type (vectype, 2, &half_vtype) @@ -2304,9 +2305,10 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info, } else { - *alignment_support_scheme - = vect_supportable_dr_alignment (vinfo, first_dr_info, vectype); *misalignment = dr_misalignment (first_dr_info, vectype); + *alignment_support_scheme + = vect_supportable_dr_alignment (vinfo, first_dr_info, vectype, + *misalignment); } if (vls_type != VLS_LOAD && first_stmt_info == stmt_info) @@ -2452,12 +2454,12 @@ get_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info, (vinfo, stmt_info, vectype, vls_type, ncopies, poffset); else *memory_access_type = VMAT_CONTIGUOUS; + *misalignment = dr_misalignment (STMT_VINFO_DR_INFO (stmt_info), + vectype); *alignment_support_scheme = vect_supportable_dr_alignment (vinfo, STMT_VINFO_DR_INFO (stmt_info), - vectype); - *misalignment = dr_misalignment (STMT_VINFO_DR_INFO (stmt_info), - vectype); + vectype, *misalignment); } } -- cgit v1.1