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]

[autovect] [committed] alignment handling improvements





Improvements to peeling for alignment:

1) don't generate runtime alignment test if the alignment is known.
Maintain the correct value in DR_MISALIGNMENT and use it to compute the
peeling factor. Accesses that have the same known misalignment amount as
the peeled reference are detected and annotated an aligned. This allows us
to avoid unaligned loads when the misalignment of the loads in the loop is
the same as the misalignment of the store we peel for. This is the case in
vect-54.c and vect-58.c, that now get vectorized on platforms that don't
support misaligned accesses.

2) Accesses that are known to have the same misalignment, even if the
misalignment amount is unknown, are detected. This allows us to avoid using
unaligned loads in examples of the following form: '*p = *p + 1' (we peel
for the store, and recognize that the load is now also aligned).

To do that I also had to change the order of analyses a bit (e.g. take the
part that determines the vectorization factor out of analyze_operations to
compute it earlier).

Also a few minor cleanups.

Bootstrapped and tested on powerpc-darwin and i686-pc-linux-gnu.

dorit

Changelog:

2004-12-15  Dorit Naishlos  <dorit@il.ibm.com>

        * tree-vectorizer.h (same_align_refs): New field in struct
        _stmt_vec_info.
        (STMT_VINFO_SAME_ALIGN_REFS): New macro to access above new field.
        (unknown_alignment_for_access_p): Replaced by
        known_alignment_for_access_p.
        (known_alignment_for_access_p): New.
        (do_peeling_for_alignment): Field made int instead of bool and
renamed
        to peeling_for_alignment.
        (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to
LOOP_PEELING_FOR_ALIGNMENT.

        * tree-vectorizer.c (vect_determine_vectorization_factor): New.
This
        functionality used to be in vect_analyze_operations.
        (vect_analyze_operations): Code to determine vectorization factor
was
        moved to vect_determine_vectorization_factor.
        (vect_gen_niters_for_prolog_loop): Handle known alignment case more
        efficiently. Use LOOP_PEELING_FOR_ALIGNMENT.
        (vect_do_peeling_for_alignment): Use fold.
        (vect_transform_loop): Use new name of
LOOP_DO_PEELING_FOR_ALIGNMENT.

        (vect_enhance_data_refs_alignment): Function made bool instead of
void.
        Documentation moved before the function. Consider datarefs with
same
        alignment. Update to correct alignment when it is known instead of
-1.
        Set peeling factor in LOOP_PEELING_FOR_ALIGNMENT.
        Check if there remain unsupported datarefs  - this was moved from
        vect_analyze_data_refs_alignment.
        (vect_analyze_data_refs_alignment): Some of the functionality moved
to
        vect_enhance_data_refs_alignment.
        (new_stmt_vec_info): Initialize same_align_datarefs varray.
        (destroy_loop_vec_info): Clear same_align_datarefs varray.
        (vect_analyze_data_ref_dependence): Push drs into the
        same_align_datarefs varray in case the dependence distance is 0.

        (vect_analyze_loop): Call vect_determine_vectorization_factor (used
to
        be part of vect_analyze_operations).
        Call vect_enhance_data_refs_alignment (used to be in
        vect_analyze_data_refs_alignment).

        (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr.
        (vect_update_inits_of_drs): Use new name of
vect_update_inits_of_dr.
        (vectorizable_store): Fix assertion to use == instead of =.
        (vect_do_peeling_for_loop_bound, vect_analyze_loop): Change debug
        printing.

        * gcc.dg/vect/vect-92.c: New test.
        * gcc.dg/vect/vect-93.c: New test.
        * gcc.dg/vect/vect-subsat.c: New test.
        * gcc.dg/vect/pr18557.c: New test.
        * gcc.dg/vect/vect-54.c: Now vectorizable on targets that don't
support
        misaligned accesses.
        * gcc.dg/vect/vect-58.c: Likewise.

patch:

(See attached file: patch.dec15_2)

Attachment: patch.dec15_2
Description: Binary data


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