diff options
author | liuhongt <hongtao.liu@intel.com> | 2022-08-04 09:04:22 +0800 |
---|---|---|
committer | liuhongt <hongtao.liu@intel.com> | 2022-09-07 08:38:18 +0800 |
commit | c13223b790bbc5e4a3f5605e057eac59b61b2c85 (patch) | |
tree | 81b0c81278cccab858a26aca5cb9528059db4b9a /libcpp/init.cc | |
parent | 25aeb92221659067b5d83c6ca1639374ce9be555 (diff) | |
download | gcc-c13223b790bbc5e4a3f5605e057eac59b61b2c85.zip gcc-c13223b790bbc5e4a3f5605e057eac59b61b2c85.tar.gz gcc-c13223b790bbc5e4a3f5605e057eac59b61b2c85.tar.bz2 |
Extend vectorizer to handle nonlinear induction for neg, mul/lshift/rshift with a constant.
For neg, the patch create a vec_init as [ a, -a, a, -a, ... ] and no
vec_step is needed to update vectorized iv since vf is always multiple
of 2(negative * negative is positive).
For shift, the patch create a vec_init as [ a, a >> c, a >> 2*c, ..]
as vec_step as [ c * nunits, c * nunits, c * nunits, ... ], vectorized iv is
updated as vec_def = vec_init >>/<< vec_step.
For mul, the patch create a vec_init as [ a, a * c, a * pow(c, 2), ..]
as vec_step as [ pow(c,nunits), pow(c,nunits),...] iv is updated as vec_def =
vec_init * vec_step.
The patch handles nonlinear iv for
1. Integer type only, floating point is not handled.
2. No slp_node.
3. iv_loop should be same as vector loop, not nested loop.
4. No UD is created, for mul, use unsigned mult to avoid UD, for
shift, shift count should be less than type precision.
gcc/ChangeLog:
PR tree-optimization/103144
* tree-vect-loop.cc (vect_is_nonlinear_iv_evolution): New function.
(vect_analyze_scalar_cycles_1): Detect nonlinear iv by upper function.
(vect_create_nonlinear_iv_init): New function.
(vect_peel_nonlinear_iv_init): Ditto.
(vect_create_nonlinear_iv_step): Ditto
(vect_create_nonlinear_iv_vec_step): Ditto
(vect_update_nonlinear_iv): Ditto
(vectorizable_nonlinear_induction): Ditto.
(vectorizable_induction): Call
vectorizable_nonlinear_induction when induction_type is not
vect_step_op_add.
* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
Update nonlinear iv for epilogue loop.
* tree-vectorizer.h (enum vect_induction_op_type): New enum.
(STMT_VINFO_LOOP_PHI_EVOLUTION_TYPE): New Macro.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr103144-mul-1.c: New test.
* gcc.target/i386/pr103144-mul-2.c: New test.
* gcc.target/i386/pr103144-neg-1.c: New test.
* gcc.target/i386/pr103144-neg-2.c: New test.
* gcc.target/i386/pr103144-shift-1.c: New test.
* gcc.target/i386/pr103144-shift-2.c: New test.
Diffstat (limited to 'libcpp/init.cc')
0 files changed, 0 insertions, 0 deletions