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] [4.2 projects] vectorize multiple data-types and type conversions


I updated the patch for the project "vectorization of multiple data types
and type conversions"  to current mainline. The patch is attached below.
The original patches I sent could still be used to review the code because
I hardly had to make any changes to the patch - updating to a current
snapshot went almost entirely smoothly. So, for reference, here are the
original patches:

1. a cleanup of the function vectorizable_load:
Original patch: http://gcc.gnu.org/ml//gcc-patches/2006-02/msg00940.html
The only change I made to this part is to address Richard Gunther's
comments about the documentation:
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00312.html

2. support vectorization of loads and stores in the presence of multiple
data types of different sizes:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00941.html

3. vectorize (simple) computations in the presence of multiple data types
of different sizes:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00942.html

4. vectorize reductions in the presence of multiple data types of different
sizes:
http://gcc.gnu.org/ml//gcc-patches/2006-02/msg00943.html

5. vectorize type demotion
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00944.html

6. vectorize type promotion
http://gcc.gnu.org/ml//gcc-patches/2006-02/msg01453.html

Bootstrapped on powerpc-linux, and tested on the vectorizer testcases.
Thanks to Vladimir for testing on i686-pc-linux-gnu (bootstrap with
vectorization enabled + vectorizer testcases, except for part6 that is yet
to be tested on i686 with current mainline.).
Thanks to rth for contributing the i386 specific bits.

thanks,
dorit

Changelog:

part1

        * tree-vect-transform.c (vect_setup_realignment): New function.
        (vectorizable_load): Replace code that was factored out into
        vect_setup_realignment with a call to vect_setup_realignment.
        Unify handling of alignd and unaligned load.

part2
        * tree-vect-transform.c (vect_align_data_ref): Removed.
        (vect_create_data_ref_ptr): Added additional argument - ptr_incr.
        Updated function documentation. Return the increment stmt in
ptr_incr.
        (bump_vector_ptr): New function.
        (vect_get_vec_def_for_stmt_copy): New function.
        (vect_finish_stmt_generation): Create a stmt_info to newly created
        vector stmts.
        (vect_setup_realignment): Call vect_create_data_ref_ptr with
additional
        argument.
        (vectorizable_reduction, vectorizable_assignment): Not supported
yet if
        VF is greater than the number of elements that can fit in one
vector
        word.
        (vectorizable_operation, vectorizable_condition): Likewise.
        (vectorizable_store, vectorizable_load): Support the case that the
VF
        is greater than the number of elements that can fit in one vector
word.
        (vect_transform_loop): Don't fail in case of multiple data-types.
        * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't
fail
        in case of multiple data-types; the smallest type determines the
VF.
        (vect_analyze_data_ref_dependence): Don't record datarefs as
same_align
        if they are of different sizes.
        (vect_update_misalignment_for_peel): Compare misalignments in terms
of
        number of elements rather than number of bytes.
        (vect_enhance_data_refs_alignment): Fix/Add dump printouts.
        (vect_can_advance_ivs_p): Fix a dump printout

part3
       * tree-vect-transform.c (vectorizable_operation): Support in the
        presence of multiple datatypes.

part4
        * tree-vect-transform.c (vectorizable_reduction): Support in the
        presence of multiple datatypes.
        (vect_transform_stmt): Removed redundant code.

part5
        * tree-vect-transform.c (vectorizable_type_demotion): New function.
        (vect_transform_stmt): Add case for type_demotion_vec_info_type.
        (vect_analyze_operations): Call vectorizable_type_demotion.
        * tree-vectorizer.h (type_demotion_vec_info_type): New enum
        stmt_vec_info_type value.
        (vectorizable_type_demotion): New function declaration.
        * tree-vect-generic.c (expand_vector_operations_1): Consider
correct
        mode.
        * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes.
        * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and
        VEC_PACK_SAT_EXPR.
        * tree-iniline.c (estimate_num_insns_1): Likewise.
        * tree-pretty-print.c (dump_generic_node, op_prio): Likewise.
        * optabs.c (optab_for_tree_code): Likewise.
        (expand_binop): In case of vec_pack_*_optabs the mode
        compared against the predicate of the result is not 'mode' (the
input
        to the function) but a mode with half the size of 'mode'.
        (init_optab): Initialize new optabs.
        * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat,
OTI_vec_pack_usat):
        New optab indices.
        (vec_pack_mod_optab, vec_pack_ssat_optab,  vec_pack_usat_optab):
New
        optabs.
        * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab):
        (vec_pack_usat_optab): Initialize new optabs.
        * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New.
        * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si):
New.

part6

        * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p):
Take
        enum argument instead of bool.
        (vect_analyze_operations): Call vectorizable_type_promotion.
        * tree-vectorizer.h (type_promotion_vec_info_type): New enum
        stmt_vec_info_type value.
        (supportable_widening_operation, vectorizable_type_promotion): New
        function declarations.
        * tree-vect-transform.c (vect_gen_widened_results_half): New
function.
        (vectorizable_type_promotion): New function.
        (vect_transform_stmt): Call vectorizable_type_promotion.
        * tree-vect-analyze.c (supportable_widening_operation): New
function.
        * tree-vect-patterns.c (vect_recog_dot_prod_pattern):
        Add implementation.
        * tree-vect-generic.c (expand_vector_operations_1): Consider
correct
        mode.
        * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR):
        (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes.
        * tree-inline.c (estimate_num_insns_1): Add cases for above new
        tree-codes.
        * tree-pretty-print.c (dump_generic_node, op_prio): Likewise.
        * expr.c (expand_expr_real_1): Likewise.
        * optabs.c (optab_for_tree_code): Likewise.
        (init_optabs): Initialize new optabs.
        * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab,
        vec_widen_smult_hi_optab, vec_widen_smult_lo_optab,
        vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab,
        vec_unpacku_lo_optab): Initialize new optabs.
        * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo):
        (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi,
        OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New
        optab indices.
        (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab):
        (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab):
        (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab):
        (vec_unpacku_lo_optab): New optabs.
        * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi):
        (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo):
        (vec_widen_smult_hi, vec_widen_smult_lo): New.

        * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB):
        (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH,
UNSPEC_VMULWLUH):
        (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New.
        (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New.
        (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to
        implement the unsigned unpacking patterns.
        (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi):
        (vec_unpacks_lo_v8hi): New signed unpacking patterns.
        (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi):
        (vec_unpacku_lo_v8hi): New unsigned unpacking patterns.
        (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi):
        (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi):
        (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi):
        (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening
        multiplication patterns.
        * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New.
        * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN):
        (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New.
        * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New.
        (rs6000_builtin_mul_widen_odd): New.
        (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined.
        (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined.
        * tree-vectorizer.h (enum vect_relevant): New enum type.
        (_stmt_vec_info): Field relevant chaned from bool to enum
        vect_relevant.
        (STMT_VINFO_RELEVANT_P): Updated.
        (STMT_VINFO_RELEVANT): New.
        * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT
        instead of STMT_VINFO_RELEVANT_P.
        * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p):
        Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT,
        and boolean variable with enum vect_relevant.
        (vect_mark_stmts_to_be_vectorized): Likewise + update
documentation.
        * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New.
        (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New.

Testsuite Changelog:

        * gcc.dg/vect/vect-multitypes-1.c: New test.
        * gcc.dg/vect/vect-multitypes-2.c: New test.
        * gcc.dg/vect/vect-multitypes-3.c: New test.
        * gcc.dg/vect/vect-multitypes-4.c: New test.
        * gcc.dg/vect/vect-multitypes-5.c: New test.
        * gcc.dg/vect/vect-multitypes-6.c: New test.
        * gcc.dg/vect/vect-multitypes-7.c: New test.
        * gcc.dg/vect/vect-multitypes-8.c: New test.
        * gcc.dg/vect/vect-multitypes-9.c: New test.
        * gcc.dg/vect/vect-multitypes-10.c: New test.

        * gcc.dg/vect/vect-1.c: Loop with multiple types removed (appears
in
        vect-9.c).
        * gcc.dg/vect/vect-106.c: Removed (duplicate of vect-9.c).
        * gcc.dg/vect/vect-9.c: Now vectorizable.
        * gcc.dg/vect/vect-reduc-dot-s16a.c: Now vectorizable also on
targets
        that support vect_widen_mult.
        * gcc.dg/vect/vect-reduc-dot-u16.c: Removed (split into two new
tests).
        * gcc.dg/vect/vect-reduc-dot-u16a.c: New test (split from
        vect-reduc-dot-u16.c).
        * gcc.dg/vect/vect-reduc-dot-u16b.c: New test (split from
        vect-reduc-dot-u16.c).
        * gcc.dg/vect/vect-reduc-dot-s8.c: Removed (split into three new
tests).
        * gcc.dg/vect/vect-reduc-dot-s8a.c: New test (split from
        vect-reduc-dot-s8.c).
        * gcc.dg/vect/vect-reduc-dot-s8b.c: New test (split from
        vect-reduc-dot-s8.c).
        * gcc.dg/vect/vect-reduc-dot-s8c.c: New test (split from
        vect-reduc-dot-s8.c).
        * gcc.dg/vect/vect-reduc-dot-u8.c: Removed (split into two new
tests).
        * gcc.dg/vect/vect-reduc-dot-u8a.c: New test (split from
        vect-reduc-dot-u8.c).
        * gcc.dg/vect/vect-reduc-dot-u8b.c: New test (split from
        vect-reduc-dot-u8.c).
        * gcc.dg/vect/vect-widen-mult-sum.c: New test.
        * gcc.dg/vect/vect-multitypes-9.c: New test.
        * gcc.dg/vect/vect-multitypes-10.c: New test.
        * gcc.dg/vect/vect-widen-mult-s16.c: New test.
        * gcc.dg/vect/vect-widen-mult-u16.c: New test.
        * gcc.dg/vect/vect-widen-mult-u8.c: New test.
        * gcc.dg/vect/vect-widen-mult-s8.c: New test.
        * gcc.dg/vect/wrapv-vect-reduc-dot-s8.c: Removed.
        * gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: New reduced version of
        wrapv-vect-reduc-dot-s8.c.
        * lib/target-supports.exp (check_effective_target_vect_pack_mod):
New.
        (check_effective_target_vect_unpack): New.
        (check_effective_target_vect_widen_sum_hi_to_si): Now also includes
        targets that support vec_unpack.
        (check_effective_target_vect_widen_sum_qi_to_hi): Likewise.
        (check_effective_target_vect_widen_mult_qi_to_hi): New.
        (check_effective_target_vect_widen_mult_hi_to_si): New.

Patch:

(See attached file: multitypes.txt)

Attachment: multitypes.txt
Description: Text document


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