This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Avoid versioning loop with unaligned step

Richard Biener <> writes:
> On Thu, Dec 20, 2018 at 2:43 PM Joern Wolfgang Rennecke <> 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.

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
for correctness.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]