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, vect] Support multiple types in SLP and generalize multi-step conversion


Hi,

This patch adds support of loops with multiple types in loop-aware SLP and
generalizes multi-step type conversions (for all types of vectorization).

In order to support multiple types in an SLP instance, the number of vector
statements to be generated is now calculated for every SLP node according
to the scalar type of the node statements, and the promotion/demotion
operations take care of the transition between different data types.

This patch also makes double step type conversion (
http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00691.html) more general,
allowing more than one intermediate step in conversion (e.g., conversion
from long long to char). Since this part touches the same code as the code
for SLP (in vectorizable_type_demotion/promotion), I put it in the same
patch.

Is there a standard utility in GCC to compute pow? I didn't find any, so I
added vect_pow2 in tree-vectorizer.h...

Bootstrapped with vectorization enabled and tested on vectorizer testsuite
on ppc-linux and x86-linux. Fully tested on x86-linux.
O.K. for mainline?

Thanks,
Ira

ChangeLog:

      * tree-vectorizer.c (supportable_widening_operation): Support
      multi-step conversion, return the number of steps in such conversion
      and the required intermediate types.
      (supportable_narrowing_operation): Likewise.
      * tree-vectorizer.h (vect_pow2): New function.
      (supportable_widening_operation): Change argument types.
      (supportable_narrowing_operation): Likewise.
      (vectorizable_type_promotion): Add an argument.
      (vectorizable_type_demotion): Likewise.
      * tree-vect-analyze.c (vect_analyze_operations): Call
      vectorizable_type_promotion and vectorizable_type_demotion with
      additional argument.
      (vect_get_and_check_slp_defs): Detect patterns.
      (vect_build_slp_tree): Add an argument, don't fail in case of
multiple
      types.
      (vect_analyze_slp_instance): Don't fail in case of multiple types.
Call
      vect_build_slp_tree with correct arguments. Calculate unrolling
factor
      according to the smallest type in the loop.
      (vect_detect_hybrid_slp_stmts): Include statements from patterns.
      * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Call
      supportable_widening_operation with correct arguments.
      * tree-vect-transform.c (vect_get_slp_defs): Add new argument, use it
      to allocate output vector operands lists.
      (vect_get_vec_defs): Add new argument, pass it to vect_get_slp_defs.
      (vect_gen_widened_results_half): Remove unused argument.
      (vectorizable_conversion): Call supportable_widening_operation,
      supportable_narrowing_operation, vect_get_vec_defs, and
      vect_gen_widened_results_half with correct arguments.
      (vectorizable_assignment): Change documentation, support multiple
      types in SLP, call vect_get_vec_defs with correct arguments.
      (vectorizable_operation): Likewise.
      (vect_get_loop_based_defs): New function.
      (vect_create_vectorized_demotion_stmts): Likewise.
      (vectorizable_type_demotion): Support loop-aware SLP and general
      multi-step conversion. Call vect_get_loop_based_defs and
      vect_create_vectorized_demotion_stmts for transformation.
      (vect_create_vectorized_promotion_stmts): New function.
      (vectorizable_type_promotion): Support loop-aware SLP and general
      multi-step conversion. Call vect_create_vectorized_promotion_stmts
      for transformation.
      (vectorizable_store): Change documentation, support multiple
      types in SLP, call vect_get_vec_defs with correct arguments.
      (vectorizable_load): Likewise.
      (vect_transform_stmt): Pass SLP_NODE to
      vectorizable_type_promotion and vectorizable_type_demotion..
      (vect_schedule_slp_instance): Move here the calculation of number
      of vectorized statements for each node from...
      (vect_schedule_slp): ... here.
      (vect_transform_loop): Call vect_schedule_slp without the last
      argument.

testsuite/ChangeLog:

      * gcc.dg/vect/slp-multitypes-1.c: New testcase.
      * gcc.dg/vect/slp-multitypes-2.c, gcc.dg/vect/slp-multitypes-3.c,
      gcc.dg/vect/slp-multitypes-4.c, gcc.dg/vect/slp-multitypes-5.c,
      gcc.dg/vect/slp-multitypes-6.c, gcc.dg/vect/slp-multitypes-7.c,
      gcc.dg/vect/slp-multitypes-8.c, gcc.dg/vect/slp-multitypes-9.c,
      gcc.dg/vect/slp-multitypes-10.c, gcc.dg/vect/slp-multitypes-11.c,
      gcc.dg/vect/slp-multitypes-12.c, gcc.dg/vect/slp-widen-mult-u8.c,
      gcc.dg/vect/slp-widen-mult-s16.c, gcc.dg/vect/vect-multitypes-16.c,.
      gcc.dg/vect/vect-multitypes-17.c: Likewise.
      * gcc.dg/vect/slp-9.c: Now vectorizable using SLP.
      * gcc.dg/vect/slp-14.c, gcc.dg/vect/slp-5.c: Likewise.
      * lib/target-supports.exp (check_effective_target_vect_long_long):
New.

(See attached file: slp-multi-types.txt)(See attached file: tests.txt)

Attachment: slp-multi-types.txt
Description: Text document

Attachment: tests.txt
Description: Text document


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