This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[patch]Autovectorization loop versioning for data alignment


Vectorization requires the data (a vector of several array
elements) to be aligned on certain boundaries.  When the
alignment of the data is unknown at compile then the code in
this patch will generate a second vectorized version of the
loop.  A runtime check of the data alignment will determine
whether the original scalar loop or the vectorized loop is
executed.  There are, of course, many other conditions that
must also be satisfied before a loop even becomes a candidate
for loop versioning for data alignment.

Included in this patch is an option ftree-vect-loop-version
so that loop versioning can be turned off.  Loop versioning
can cause code bloat and may not be desirable even if other
autovectorization is requested.  Loop versioning is also
turned off when the Os (optimize for size) option is specified.

This is "Loop versioning for alignment" item 2.1 from the
autovectorization enhancements list.

tested on ppc

OK for mainline?

Keith

Changelog:

      2005-06-16  Keith Besaw  <kbesaw@us.ibm.com>

      * common.opt: Add ftree-vect-loop-version option.
      * doc/invoke.texi: Document ftree-vect-loop-version.
        * tree-vectorizer.h (_loop_vec_info): Add ptr_mask,
      may_misalign_stmts, and MAX_RUNTIME_ALIGNMENT_CHECKS.
        * tree-vectorizer.h (new_stmt_vec_info): VEC_alloc for
      STMT_VINFO_SAME_ALIGN_REFS.
      (new_loop_vec_info): VEC_alloc for LOOP_VINFO_MAY_MISALIGN_STMTS.
      (destroy_loop_vec_info): VEC_free for
      LOOP_VINFO_MAY_MISALIGN_STMTS.
      * tree-vect-analyze.c (vect_update_misalignment_for_peel): New.
      (vect_enhance_data_refs_alignment): Update to choose loop
      peeling or loop versioning if appropriate for the (potentially)
      unaligned data references in the loop.
      (vect_analyze_data_refs_alignment): Remove call to
      vect_enhance_data_refs_alignment so the checks can be done
      earlier.
      (vect_analyze_loop): Add call to vect_enhance_data_refs_alignment
      and move up call to vect_analyze_data_refs_alignment.
        * tree-vect-transform.c (vect_create_cond_for_align_checks): New.
      (vect_transform_loop): Add call to loop_version.

New test cases vect-95.c and vect-95a.c

   

Attachment: vect.6-16m.diff
Description: Binary data

Attachment: vect-95.c
Description: Binary data

Attachment: vect-95a.c
Description: Binary data


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