Fix peeling for alignment with negative step
authorRichard Biener <rguenther@suse.de>
Wed, 29 Sep 2021 09:18:23 +0000 (11:18 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 29 Sep 2021 11:46:39 +0000 (13:46 +0200)
commit4c7731081647c22cbd249dc0faa20c3df9ed6411
tree174a6e344ceac511ebd4f06a875c851aa473198c
parenta459ee44c0a74b0df0485ed7a56683816c02aae9
Fix peeling for alignment with negative step

The following fixes a regression causing us to no longer peel
negative step loops for alignment.  With dr_misalignment now
applying the bias for negative step we have to do the reverse
when adjusting the misalignment for peeled DRs.

2021-09-29  Richard Biener  <rguenther@suse.de>

* tree-vect-data-refs.c (vect_dr_misalign_for_aligned_access):
New helper.
(vect_update_misalignment_for_peel): Use it to update
misaligned to the value necessary for an aligned access.
(vect_get_peeling_costs_all_drs): Likewise.
(vect_enhance_data_refs_alignment): Likewise.

* gcc.target/i386/vect-alignment-peeling-1.c: New testcase.
* gcc.target/i386/vect-alignment-peeling-2.c: Likewise.
gcc/testsuite/gcc.target/i386/vect-alignment-peeling-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-alignment-peeling-2.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c