This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] alignment and loop peeling (vectorization)
- From: Devang Patel <dpatel at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Dorit Naishlos <DORIT at il dot ibm dot com>
- Date: Thu, 2 Mar 2006 13:58:17 -0800
- Subject: [PATCH] alignment and loop peeling (vectorization)
:ADDPATCH SSA (vectorizer):
Hi All,
This has been discussed in few threads ...
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg02246.html
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01715.html
Vectorizer uses loop peeling technique to peel N loop iterations to
reach vector alignment. At the moment, it assumes that vector
alignment will be reached after N iterations. And when it does not,
program usually crashes at runtime.
However, when initial data reference misalignment is known it is
possible to decide, at compile time, whether vector alignment is
reachable using N number of iterations or not. If it is not possible
then loop peeling transformation is not applied. (Earlier I prepared
small patch for this case - msg02246.html. It is not yet OKed for
mainline, so I am including it in this patch also).
New target hook is added when initial data ref alignment is unknown
at compile time. This target hook determines whether vector alignment
is reachable at runtime or not based on current alignment mode and
scalar base type info. RS6000/darwin specific target hooks is
provided with this patch. Default target hook is provided for targets
that does not have specialized hooks.
Bootstrapped and tested on powerpc-darwin.
OK for mainline ?
Thanks,
-
Devang
2006-03-02 Devang Patel <dpatel@apple.com>
Dorit Nuzman <dorit@il.ibm.com>
* targethooks.c (default_vector_alignment_reachable): New.
* targethooks.h (default_vector_alignment_reachable,
vector_alignment_reachable): Declare.
* target.h (vector_alignment_reachable): New member for
targetm.vectorize.
* tree-vect-analyze.c (vect_enhance_data_refs_alignment):
Avoid peeling
when vector alignment is not reachable.
(target.h): Include.
* target-def.h (TARGET_VECTOR_ALIGNMENT_REACHABLE): New.
* Makefile.in (tree-vect-analyze.c): Depend on target.h
* config/rs6000/rs6000.c
(rs6000_vector_alignment_reachable): New.
(TARGET_VECTOR_ALIGNMENT_REACHABLE): Define.
* gcc.dg/vect/vect-align-1.c: New.
* gcc.dg/vect/vect-align-2.c: New.
Attachment:
av_alignment_peeling.diff
Description: Binary data