On Wed, Nov 12, 2014 at 6:52 PM, Alan Lawrence <alan.lawre...@arm.com> wrote: > This is a preliminary to patch 2, which wants functionality equivalent to > vect_gen_perm_mask (converting a char* to an RTL const_vector) but without > the check of can_vec_perm_p. > > All existing calls to vect_gen_perm_mask barring that in > perm_mask_for_reverse, assert the return value is non-null. Hence, this > patch splits the existing vect_gen_perm_mask into two: a checked variant > which makes the equivalent assertion; and an unchecked variant, which just > turns any char* into an equivalent const_vector. > > (An) alternative strategy would be merely to remove the check from > vect_gen_perm_mask (so equivalent to this patch's vect_gen_perm_mask_any), > and add a preceding assert at all callsites (i.e. changing the many > "gen_vect_perm_mask (...); assert (... != NULL);" into "assert > (can_vec_perm_p (...)); gen_vect_perm_mask (...);" - that would work just as > well as far as this patch series is concerned. > > On its own, bootstrapped on x86-none-linux-gnu (more testing with patches > 2+3).
Ok. Thanks, Richard. > gcc/ChangeLog: > > * tree-vectorizer.h (vect_gen_perm_mask): Remove. > (vect_gen_perm_mask_checked, vect_gen_perm_mask_any): New. > > tree_vec_data_refs.c (vect_permute_load_chain, > vec_permute_store_chain, > vec_shift_permute_load_chain): Replace vect_gen_perm_mask & assert > with vect_gen_perm_mask_checked. > > * tree-vect-stmts.c (vectorizable_mask_load_store, > vectorizable_load): > Likewise. > > (vect_gen_perm_mask_checked): New. > (vect_gen_perm_mask): Remove can_vec_perm_p check, rename to... > (vect_gen_perm_mask_any): ...this. > > (perm_mask_for_reverse): Call can_vec_perm_p and > vect_gen_perm_mask_checked.