RFA: Avoid versioning loop with unaligned step

Richard Biener richard.guenther@gmail.com
Thu Dec 20 16:32:00 GMT 2018


On Thu, Dec 20, 2018 at 2:43 PM Joern Wolfgang Rennecke <gnu@amylaar.uk> wrote:
>
> eSi-RISC has vector permute functionality, but no unaligned loads. We
> see execution failures on gcc.dg/vect/slp-perm-12.c because loop
> versioning is used to make the tptr aligned for the first loop
> iteration, and then with a step of originally 11, 22 after
> vectorization, and a vector alignment of 8 bytes, the second iteration
> causes an AlignmentError exception.
> The attached patch to tree-vect-data-refs.c suppresses attempts to align
> data accesses where the
> step alignment times the vectorization factor is insufficient to sustain
> the alignment during the loop.
> Bootstrapped and regression tested on x86_64-pc-linux-gnu .
>
> I have also attached a matching testsuite patch to not expect SLP
> vectorization for slp-perm-12 when
> no unaligned loads are available, although in terms of testing, I can
> only say that it works for us.

vect_compute_data_ref_alignment uses DR_TARGET_ALIGNMENT
and DR_STEP_ALIGNMENT () % dr_target-alignment == 0 as check.

I think it's preferable to use the same or similar values for the desired
alignment.

Otherwise this looks OK to me.

Richard.



More information about the Gcc-patches mailing list