* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
@ 2012-06-26 8:31 ` jakub at gcc dot gnu.org
2012-06-26 8:36 ` rguenther at suse dot de
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-06-26 8:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-26 08:31:36 UTC ---
Seems this is vect_is_simple_reduction_1's:
if (check_reduction)
{
/* Swap operands (just for simplicity - so that the rest of the code
can assume that the reduction variable is always the last (second)
argument). */
if (vect_print_dump_info (REPORT_DETAILS))
report_vect_op (def_stmt,
"detected reduction: need to swap operands: ");
swap_tree_operands (def_stmt, gimple_assign_rhs1_ptr (def_stmt),
gimple_assign_rhs2_ptr (def_stmt));
}
at least on the first testcase. Now, the question is how hard would it be to
adjust the vectorizer so that it would work even without doing this swapping,
or
alternatively if we shouldn't canonicalize the operand order afterwards.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
2012-06-26 8:31 ` [Bug tree-optimization/53773] " jakub at gcc dot gnu.org
@ 2012-06-26 8:36 ` rguenther at suse dot de
2012-06-26 8:52 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenther at suse dot de @ 2012-06-26 8:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
--- Comment #2 from rguenther at suse dot de <rguenther at suse dot de> 2012-06-26 08:35:59 UTC ---
On Tue, 26 Jun 2012, jakub at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |jakub at gcc dot gnu.org
>
> --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-26 08:31:36 UTC ---
> Seems this is vect_is_simple_reduction_1's:
> if (check_reduction)
> {
> /* Swap operands (just for simplicity - so that the rest of the code
> can assume that the reduction variable is always the last (second)
> argument). */
> if (vect_print_dump_info (REPORT_DETAILS))
> report_vect_op (def_stmt,
> "detected reduction: need to swap operands: ");
>
> swap_tree_operands (def_stmt, gimple_assign_rhs1_ptr (def_stmt),
> gimple_assign_rhs2_ptr (def_stmt));
> }
>
> at least on the first testcase. Now, the question is how hard would it be to
> adjust the vectorizer so that it would work even without doing this swapping,
> or
> alternatively if we shouldn't canonicalize the operand order afterwards.
Or change it to "just for simplicity - ... that the reduction variable is
always the first argument.". Eventually that will wreck with reduction
of MINUS_EXPR though, not sure.
Richard.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
2012-06-26 8:31 ` [Bug tree-optimization/53773] " jakub at gcc dot gnu.org
2012-06-26 8:36 ` rguenther at suse dot de
@ 2012-06-26 8:52 ` rguenth at gcc dot gnu.org
2012-07-27 16:27 ` wschmidt at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-26 8:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-06-26
Ever Confirmed|0 |1
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-26 08:52:21 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (2 preceding siblings ...)
2012-06-26 8:52 ` rguenth at gcc dot gnu.org
@ 2012-07-27 16:27 ` wschmidt at gcc dot gnu.org
2012-07-29 16:55 ` wschmidt at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-07-27 16:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
--- Comment #4 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-07-27 16:26:47 UTC ---
Operand swapping is also done in vect_is_slp_reduction.
Places that rely on the reduction operand being the last operand:
* vect_model_reduction_cost
* vectorizable_reduction
* vect_recog_dot_prod_pattern
* vect_recog_widen_sum_pattern
Some commentary in vectorizable_reduction indicates that the last-operand rule
is not used for nested cycles, so there are a few places where a reduc_index
parameter is passed around instead.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (3 preceding siblings ...)
2012-07-27 16:27 ` wschmidt at gcc dot gnu.org
@ 2012-07-29 16:55 ` wschmidt at gcc dot gnu.org
2012-07-29 16:56 ` wschmidt at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-07-29 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
William J. Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot |wschmidt at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.8.0
--- Comment #5 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-07-29 16:54:45 UTC ---
I'll take this one.
I think the assumption of operand placement is too embedded to tease out
easily, so I'm going to approach this by re-canonicalizing PLUS_EXPR,
POINTER_PLUS_EXPR, and MULT_EXPR when operand swapping has occurred. Are there
other tree codes that could be broken?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (4 preceding siblings ...)
2012-07-29 16:55 ` wschmidt at gcc dot gnu.org
@ 2012-07-29 16:56 ` wschmidt at gcc dot gnu.org
2012-07-30 8:47 ` rguenther at suse dot de
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-07-29 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
William J. Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (5 preceding siblings ...)
2012-07-29 16:56 ` wschmidt at gcc dot gnu.org
@ 2012-07-30 8:47 ` rguenther at suse dot de
2012-07-31 12:25 ` wschmidt at gcc dot gnu.org
2012-07-31 12:26 ` wschmidt at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenther at suse dot de @ 2012-07-30 8:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> 2012-07-30 08:47:35 UTC ---
On Sun, 29 Jul 2012, wschmidt at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
>
> William J. Schmidt <wschmidt at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> AssignedTo|unassigned at gcc dot |wschmidt at gcc dot gnu.org
> |gnu.org |
> Target Milestone|--- |4.8.0
>
> --- Comment #5 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-07-29 16:54:45 UTC ---
> I'll take this one.
>
> I think the assumption of operand placement is too embedded to tease out
> easily, so I'm going to approach this by re-canonicalizing PLUS_EXPR,
> POINTER_PLUS_EXPR, and MULT_EXPR when operand swapping has occurred. Are there
> other tree codes that could be broken?
I don't think so
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (6 preceding siblings ...)
2012-07-30 8:47 ` rguenther at suse dot de
@ 2012-07-31 12:25 ` wschmidt at gcc dot gnu.org
2012-07-31 12:26 ` wschmidt at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-07-31 12:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
--- Comment #7 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-07-31 12:25:10 UTC ---
Author: wschmidt
Date: Tue Jul 31 12:25:04 2012
New Revision: 190007
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190007
Log:
gcc:
2012-07-31 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/53773
* tree-vectorizer.h (struct _loop_vec_info): Add operands_swapped.
(LOOP_VINFO_OPERANDS_SWAPPED): New macro.
* tree-vect-loop.c (new_loop_vec_info): Initialize
LOOP_VINFO_OPERANDS_SWAPPED field.
(destroy_loop_vec_info): Restore canonical form.
(vect_is_slp_reduction): Set LOOP_VINFO_OPERANDS_SWAPPED field.
(vect_is_simple_reduction_1): Likewise.
gcc/testsuite:
2012-07-31 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/53773
* testsuite/gcc.dg/vect/pr53773.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/vect/pr53773.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-loop.c
trunk/gcc/tree-vectorizer.h
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/53773] Vectorizer generates non-canonical multiplies
2012-06-25 22:16 [Bug tree-optimization/53773] New: Vectorizer generates non-canonical multiplies wschmidt at gcc dot gnu.org
` (7 preceding siblings ...)
2012-07-31 12:25 ` wschmidt at gcc dot gnu.org
@ 2012-07-31 12:26 ` wschmidt at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-07-31 12:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53773
William J. Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-07-31 12:26:37 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 10+ messages in thread