This is the mail archive of the
mailing list for the GCC project.
Re: RFA: Avoid versioning loop with unaligned step
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Joern Wolfgang Rennecke <gnu at amylaar dot uk>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Dec 2018 19:46:31 +0000
- Subject: Re: RFA: Avoid versioning loop with unaligned step
- References: <5C1B9C8E.firstname.lastname@example.org> <CAFiYyc3hyzN_YTQ7WsU-8zysYv84Er=GJmfE9trOj_M1SHiMrQ@mail.gmail.com>
Richard Biener <email@example.com> writes:
> On Thu, Dec 20, 2018 at 2:43 PM Joern Wolfgang Rennecke <firstname.lastname@example.org> 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
Yeah, I agree testing for a multiple is better than maybe_lt,
and that we should be using DR_TARGET_ALIGNMENT rather than
(TYPE_ALIGN_UNIT is the ABI alignment, which might be higher or lower
than the alignment the vectoriser is aiming for. And I think the
reasons for bailing out apply whenever the vectoriser can't reach
the alignment it's aiming for, even if the alignment isn't needed