[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 Richard Biener changed: What|Removed |Added Status|ASSIGNED|RESOLVED Known to work||8.0 Resolution|--- |FIXED --- Comment #5 from Richard Biener --- Fixed on trunk.
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 --- Comment #6 from Richard Biener --- Author: rguenth Date: Thu Jul 20 11:17:21 2017 New Revision: 250382 URL: https://gcc.gnu.org/viewcvs?rev=250382=gcc=rev Log: 2017-07-20 Richard BienerPR tree-optimization/61171 * tree-vectorizer.h (slp_instance): Add reduc_phis member. (vect_analyze_stmt): Add slp instance parameter. (vectorizable_reduction): Likewise. * tree-vect-loop.c (vect_analyze_loop_operations): Adjust. (vect_is_simple_reduction): Deal with chains not detected as SLP reduction chain, specifically not properly associated chains containing a mix of plus/minus. (get_reduction_op): Remove. (get_initial_defs_for_reduction): Simplify, pass in whether this is a reduction chain, pass in the SLP node for the PHIs. (vect_create_epilog_for_reduction): Get the SLP instance as arg and adjust. (vectorizable_reduction): Get the SLP instance as arg. During analysis remember the SLP node with the PHIs in the instance. Simplify getting at the vectorized reduction PHIs. * tree-vect-slp.c (vect_slp_analyze_node_operations): Pass through SLP instance. (vect_slp_analyze_operations): Likewise. * tree-vect-stms.c (vect_analyze_stmt): Likewise. (vect_transform_stmt): Likewise. * g++.dg/vect/pr61171.cc: New testcase. * gfortran.dg/vect/pr61171.f: Likewise. * gcc.dg/vect/vect-reduc-11.c: Likewise. Added: trunk/gcc/testsuite/g++.dg/vect/pr61171.cc trunk/gcc/testsuite/gcc.dg/vect/vect-reduc-11.c trunk/gcc/testsuite/gfortran.dg/vect/pr61171.f Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-loop.c trunk/gcc/tree-vect-slp.c trunk/gcc/tree-vect-stmts.c trunk/gcc/tree-vectorizer.h
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED Last reconfirmed|2015-04-29 00:00:00 |2017-6-8 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #4 from Richard Biener --- Reconfirmed, mine.
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 Andrew Pinski changed: What|Removed |Added Severity|normal |enhancement
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 --- Comment #3 from Richard Biener --- it's a matter of association being "unfortunate" or vector reduction detection being too simplistic. # prephitmp_21 = PHI... _2 = pretmp_18 + prephitmp_21; _9 = _2 - _6; needs to be associated as _2 = pretmp_18 - _6; _9 = prephitmp_21 + _2; usually reassoc is responsible for ensuring this but given its last iteration is before LIM pulls out the global it has no chance to fix things up. One fix would be to split out enough from reassoc into a worker that can be called from vectorization or to run LIM before reassoc.
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 alalaw01 at gcc dot gnu.org changed: What|Removed |Added CC||alalaw01 at gcc dot gnu.org --- Comment #2 from alalaw01 at gcc dot gnu.org --- This vectorizes fine, if vv is made a local variable: float isOk() { float vv = 0; for (int j=0U; jN; ++j) { float ax = xx-px[j]; vv+=ax; } return vv; }
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2015-04-29 Ever confirmed|0 |1 --- Comment #1 from Richard Biener rguenth at gcc dot gnu.org --- Confirmed.