diff options
author | Richard Biener <rguenther@suse.de> | 2017-10-06 07:03:23 +0000 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2017-10-06 07:03:23 +0000 |
commit | cfd399a7515abd830d2cf3cd124e460e5ae03542 (patch) | |
tree | 206f6d8187527031fe3d1075b68b8c1e72222ced /gcc | |
parent | 4b76b881b438db0b312334d5ddb5aa5ee58c870a (diff) |
2017-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/82436
* tree-vect-slp.c (vect_supported_load_permutation_p): More
conservatively choose the vectorization factor when checking
whether we can perform the required load permutation.
(vect_transform_slp_perm_load): Assert when we may not fail.
* gcc.dg/vect/pr82436.c: New testcase.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@253473 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr82436.c | 35 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 18 |
4 files changed, 61 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38a86abaa39..06aaa06f75d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-10-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82436 + * tree-vect-slp.c (vect_supported_load_permutation_p): More + conservatively choose the vectorization factor when checking + whether we can perform the required load permutation. + (vect_transform_slp_perm_load): Assert when we may not fail. + 2017-10-05 Segher Boessenkool <segher@kernel.crashing.org> * config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Correct error diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a3a5c8920a..dd39b78e7ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82436 + * gcc.dg/vect/pr82436.c: New testcase. + 2017-10-05 Bernd Edlinger <bernd.edlinger@hotmail.de> * gcc.dg/Wincompatible-pointer-types-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/pr82436.c b/gcc/testsuite/gcc.dg/vect/pr82436.c new file mode 100644 index 00000000000..4129e15447f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr82436.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-Ofast -fno-tree-scev-cprop" } */ +/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */ + +struct reflection_type +{ + int h; + int k; + int l; + double f_exp; + double f_sigma; + _Complex double f_calc; + double f_pred; + double i_exp; + double i_sigma; + double i_pred; +}; + +double y, w; +int foo (struct reflection_type *r, int n, unsigned s) +{ + int i; + y = 0; + w = 0; + for (i = 1; i < n; ++i) + { + struct reflection_type *x = &r[i*s]; + double fpred = x->f_pred; + double fexp = x->f_exp; + double tem = (fpred - fexp); + y += __builtin_fabs (tem / x->f_sigma); + w += __builtin_fabs (tem / fexp); + } + return i; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 5e40a374180..bc81b3d4b04 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1629,14 +1629,20 @@ vect_supported_load_permutation_p (slp_instance slp_instn) return true; } - /* For loop vectorization verify we can generate the permutation. */ + /* For loop vectorization verify we can generate the permutation. Be + conservative about the vectorization factor, there are permutations + that will use three vector inputs only starting from a specific factor + and the vectorization factor is not yet final. + ??? The SLP instance unrolling factor might not be the maximum one. */ unsigned n_perms; + unsigned test_vf + = least_common_multiple (SLP_INSTANCE_UNROLLING_FACTOR (slp_instn), + LOOP_VINFO_VECT_FACTOR + (STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt)))); FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) if (node->load_permutation.exists () - && !vect_transform_slp_perm_load - (node, vNULL, NULL, - SLP_INSTANCE_UNROLLING_FACTOR (slp_instn), slp_instn, true, - &n_perms)) + && !vect_transform_slp_perm_load (node, vNULL, NULL, test_vf, + slp_instn, true, &n_perms)) return false; return true; @@ -3613,6 +3619,7 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain, dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } + gcc_assert (analyze_only); return false; } @@ -3636,6 +3643,7 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain, dump_printf (MSG_MISSED_OPTIMIZATION, "%d ", mask[i]); dump_printf (MSG_MISSED_OPTIMIZATION, "}\n"); } + gcc_assert (analyze_only); return false; } |