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] fixes/cleanups


A few fixups/cleanups. The only functionality change is w.r.t reduction
handling: as mentioned in
http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00044.html:
"
6) The handling of inner-loop reduction (within the context of outer-loop
vectorization) has a bug and a feature: As explained above, the inner-loop
executes sequentially. However, we use the same routines as we have now to
classify scalar-cycles; this means that (1) we miss an optimization
opportunities: we think that we can't vectorize the loop if we operate in
the inner-loop on floats and fast-math is not on, and we don't support
inner-loop reductions when they are used in the inner-loop, although we
could. (2) we have a bug: stmts that are used only by operations that are
classified as a reduction are marked as "used_by_reduction", which
indicates that the order of computation when vectorizing these stmts
doesn't matter. However, in the case of inner-loop "reduction" it does
matter, cause we do preserve the order of computation. So we really need to
classify "inner-loop reductions" differently than regular reductions.
"
This patch fixes the above. W.r.t (1) - we don't require fast-math anymore
for inner-loop reduction. We still check uses inside the inner-loop (yet to
be fixed). W.r.t (2) - an inner-loop operation, including inner-loop
reduction, that is used in the outer-loop
("used_in_outer"/"used_in_outer_by_reduction"), is treated as an operation
whose computation order needs to be preserved.

The rest is misc. minor cleanups.

Bootstrapped with vectorization enabled and tested on the vectorizer
testcases on i386-linux and ppc-linux.
Committed to autovect branch.

dorit

        * tree-vectorizer.h (nested_in_vect_loop_p): New function.
        * tree-vect-transform.c (vect_init_vector): Call
nested_in_vect_loop_p.
        (get_initial_def_for_reduction): Likewise.
        (vect_create_epilog_for_reduction): Likewise.
        * tree-vectorizer.c (vect_is_simple_use): Remove multitypes check.
        Moved to vectorizable_* functions.
        * tree-vect-transform.c (vectorizable_reduction): Call
        nested_in_vect_loop_p. Check for multitypes in the inner-loop.
        (vectorizable_call): Likewise.
        (vectorizable_conversion): Likewise.
        (vectorizable_operation): Likewise.
        (vectorizable_type_promotion): Likewise.
        (vectorizable_type_demotion): Likewise.
        (vectorizable_store): Likewise.
        (vectorizable_live_operation): Likewise.

        * tree-vectorizer.c (supportable_widening_operation): Also check if
        used by an outer-loop reduction.
        (vect_is_simple_reduction): Takes a loop_vec_info as argument
instead
        of struct loop. Call nested_in_vect_loop_p and don't require
        flag_unsafe_math_optimizations if it returns true.
        * tree-vectorizer.h (vect_is_simple_reduction): Takes a
loop_vec_info
        as argument instead of struct loop.
        * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function.
        Same code as what used to be vect_analyze_scalar_cycles, only with
        additional argument loop, and loop_info passed to
        vect_is_simple_reduction instead of loop.
        (vect_analyze_scalar_cycles): Code factored out into
        vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest.
        Updated documentation.
        (vect_mark_stmts_to_be_vectorized): 'relevant' doen't change to
        vect_used_by_reduction in case it is vect_used_in_outer*.
        (vect_analyze_loop_1): Don't call vect_analyze_scalar_cycles.
        * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Check if
there
        are uses in the loop.
        * tree-vect-transform.c (vectorizable_reduction): pass loop_info to
        vect_is_simple_reduction instead of loop.

        * tree-vect-analyze.c (process_use): Remove printouts.
        * tree-vect-transform.c (get_initial_def_for_induction): Fix
        indentation.


Patch:

(See attached file: clean.may22.txt)

Attachment: clean.may22.txt
Description: Text document


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