On Mon, 30 Nov 2009 15:02:48 +0000 Richard Earnshaw wrote: > I certainly think we shouldn't be hiding knowledge about the element > to vector-lane mapping from the vectorizer -- and that the vectorizer > should understand that vector copies are not necessarily the same as > vectorizing loads. Anything else and we will ultimately have parts of > the compiler fighting against each other and that way lies subtle > bugs. This is a version of the patch which doesn't attempt to resolve the discrepancy between vector copies and vectorizing loads/stores (thus is only intended to work in little-endian mode, leaving big-endian mode as an open problem). So, vldr/vstr etc. will still be used for aligned accesses, and any issues with adding semantics to movmisalign are sidestepped. As with previous versions of the patch, there are several new failures in the vector testsuite. Ira Rosen wrote: > > > > --- a/gcc/tree-vect-data-refs.c > > > > +++ b/gcc/tree-vect-data-refs.c > > > > @@ -796,7 +796,8 @@ vect_compute_data_ref_alignment (struct > > > data_reference *dr) > > > > /* At this point we assume that the base is aligned. */ > > > > gcc_assert (base_aligned > > > > || (TREE_CODE (base) == VAR_DECL > > > > - && DECL_ALIGN (base) >= TYPE_ALIGN (vectype))); > > > > + && (DECL_ALIGN (base) > > > > + >= targetm.vectorize.vector_min_alignment > > > > (vectype)))); > > > > > > Looks like you forgot to multiply by BITS_PER_UNIT here. > > > > Fixed. > > Not in the attached patch... (I changed DECL_ALIGN to DECL_ALIGN_UNIT, so both copies of the inequality were in units, rather than explicitly multiplying by BITS_PER_UNIT. I should probably have mentioned that...) OK to apply? Julian ChangeLog Julian Brown Paul Brook Daniel Jacobowitz Joseph Myers gcc/ * target-def.h (TARGET_VECTOR_MIN_ALIGNMENT): Define. (TARGET_VECTORIZE): Use above. * target.h (gcc_target): Add vectorize.vector_min_alignment. * targhooks.c (default_vector_min_alignment): New function. * targhooks.h (default_vector_min_alignment): Add prototype. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use targetm.vectorize.vector_min_alignment. * tree-vect-loop-manip.c (target.h): Include. (vect_gen_niters_for_prolog_loop): Use targetm.vectorize.vector_min_alignment. * config/arm/arm.c (arm_vector_min_alignment): New function. (TARGET_VECTOR_MIN_ALIGNMENT): Define macro, using above. (neon_vector_mem_operand): Disallow PRE_DEC for array loads. (arm_print_operand): Include alignment qualifier in %A. * config/arm/neon.md (UNSPEC_MISALIGNED_ACCESS): New constant. (movmisalign): New expander. (movmisalign_neon_store, movmisalign_neon_load): New insn patterns. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_vect_no_misalign): New function. (check_effective_target_vect_no_align): Use above. (check_effective_target_vect_element_align): New function. * gcc.dg/vect/no-section-anchors-vect-31.c: Use vect_element_align (instead of vect_hw_misalign where appropriate). * gcc.dg/vect/no-section-anchors-vect-64.c: Ditto. * gcc.dg/vect/no-section-anchors-vect-66.c: Ditto. * gcc.dg/vect/no-section-anchors-vect-68.c: Ditto. * gcc.dg/vect/no-section-anchors-vect-69.c: Ditto. * gcc.dg/vect/no-scebccp-outer-8.c: Ditto. * gcc.dg/vect/pr25413.c: Ditto. * gcc.dg/vect/section-anchors-vect-69.c: Ditto. * gcc.dg/vect/slp-25.c: Ditto. * gcc.dg/vect/vect-109.c: Ditto. * gcc.dg/vect/vect-26.c: Ditto. * gcc.dg/vect/vect-27.c: Ditto. * gcc.dg/vect/vect-28.c: Ditto. * gcc.dg/vect/vect-29.c: Ditto. * gcc.dg/vect/vect-33.c: Ditto. * gcc.dg/vect/vect-42.c: Ditto. * gcc.dg/vect/vect-44.c: Ditto. * gcc.dg/vect/vect-48.c: Ditto. * gcc.dg/vect/vect-50.c: Ditto. * gcc.dg/vect/vect-52.c: Ditto. * gcc.dg/vect/vect-54.c: Ditto. * gcc.dg/vect/vect-56.c: Ditto. * gcc.dg/vect/vect-58.c: Ditto. * gcc.dg/vect/vect-60.c: Ditto. * gcc.dg/vect/vect-70.c: Ditto. * gcc.dg/vect/vect-72.c: Ditto. * gcc.dg/vect/vect-75.c: Ditto. * gcc.dg/vect/vect-87.c: Ditto. * gcc.dg/vect/vect-88.c: Ditto. * gcc.dg/vect/vect-89.c: Ditto. * gcc.dg/vect/vect-91.c: Ditto. * gcc.dg/vect/vect-92.c: Ditto. * gcc.dg/vect/vect-93.c: Ditto. * gcc.dg/vect/vect-95.c: Ditto. * gcc.dg/vect/vect-96.c: Ditto. * gcc.dg/vect/vect-align-1.c: Ditto. * gcc.dg/vect/vect-align-2.c: Ditto. * gcc.dg/vect/vect-multitypes-1.c: Ditto. * gcc.dg/vect/vect-multitypes-3.c: Ditto. * gcc.dg/vect/vect-multitypes-4.c: Ditto. * gcc.dg/vect/vect-multitypes-6.c: Ditto. * gfortran.dg/vect/vect-2.f90: Ditto. * gfortran.dg/vect/vect-3.f90: Ditto. * gfortran.dg/vect/vect-4.f90: Ditto. * gfortran.dg/vect/vect-5.f90: Ditto.