public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y
@ 2010-12-03 14:54 rguenth at gcc dot gnu.org
  2010-12-03 15:39 ` [Bug tree-optimization/46785] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 14:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

           Summary: Doesn't vectorize reduction x += y*y
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: irar@gcc.gnu.org


When looking at why GCC is so slow with the himeno benchmark in the usual
Phoronix testing I noticed that we do not vectorize the reduction in

float x[1024];
float
test (void)
{
  int i;
  float gosa = 0.0;
  for (i = 0; i < 1024; ++i)
    {
      float tem = x[i];
      gosa += tem * tem;
    }
  return gosa;
}

because at analysis time we have

D.3171_6 = __builtin_powf (tem_5, 2.0e+0);

as the def for the addition which doesn't satisfy is_gimple_assign
nor any of the vinfo tests:

$3 = {type = undef_vec_info_type, live = 0 '\000', in_pattern_p = 0 '\000', 
  read_write_dep = 0 '\000', stmt = 0x7ffff7edc908, loop_vinfo = 0x18f77e0, 
  vectype = 0x0, vectorized_stmt = 0x0, data_ref_info = 0x0, 
  dr_base_address = 0x0, dr_init = 0x0, dr_offset = 0x0, dr_step = 0x0, 
  dr_aligned_to = 0x0, related_stmt = 0x0, same_align_refs = 0x18cf7f0, 
  def_type = vect_internal_def, slp_type = loop_vect, first_dr = 0x0, 
  next_dr = 0x0, same_dr_stmt = 0x0, size = 0, store_count = 0, gap = 0, 
  relevant = vect_unused_in_scope, cost = {outside_of_loop = 0, 
    inside_of_loop = 0}, bb_vinfo = 0x0, vectorizable = 1 '\001'}

As we want to allow internal defs we can also just let calls slip through
here (so we vectorize reductions with veclib vectorized calls as well).

Ira?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/46785] Doesn't vectorize reduction x += y*y
  2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
@ 2010-12-03 15:39 ` rguenth at gcc dot gnu.org
  2010-12-05  8:31 ` irar at il dot ibm.com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 15:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 15:39:49 UTC ---
Btw, I wonder why we bother to check the defs at all and not just do

     def1 && flow_bb_inside_loop_p (loop, gimple_bb (def1))

we should be able to handle all vectorizable reduction operands, and
their vectorizability will be determined anyway.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/46785] Doesn't vectorize reduction x += y*y
  2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
  2010-12-03 15:39 ` [Bug tree-optimization/46785] " rguenth at gcc dot gnu.org
@ 2010-12-05  8:31 ` irar at il dot ibm.com
  2010-12-05 11:30 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: irar at il dot ibm.com @ 2010-12-05  8:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #2 from Ira Rosen <irar at il dot ibm.com> 2010-12-05 08:31:38 UTC ---

> As we want to allow internal defs we can also just let calls slip through
> here (so we vectorize reductions with veclib vectorized calls as well).

Right.

(In reply to comment #1)
> Btw, I wonder why we bother to check the defs at all and not just do
> 
>      def1 && flow_bb_inside_loop_p (loop, gimple_bb (def1))
> 
> we should be able to handle all vectorizable reduction operands, and
> their vectorizability will be determined anyway.

This checks that the other def is not a reduction too.

Ira


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/46785] Doesn't vectorize reduction x += y*y
  2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
  2010-12-03 15:39 ` [Bug tree-optimization/46785] " rguenth at gcc dot gnu.org
  2010-12-05  8:31 ` irar at il dot ibm.com
@ 2010-12-05 11:30 ` rguenth at gcc dot gnu.org
  2010-12-06 10:05 ` rguenth at gcc dot gnu.org
  2010-12-06 10:09 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-05 11:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.12.05 11:30:05
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-05 11:30:05 UTC ---
I have a tested patch.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/46785] Doesn't vectorize reduction x += y*y
  2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-12-05 11:30 ` rguenth at gcc dot gnu.org
@ 2010-12-06 10:05 ` rguenth at gcc dot gnu.org
  2010-12-06 10:09 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-06 10:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-06 10:05:11 UTC ---
Author: rguenth
Date: Mon Dec  6 10:05:07 2010
New Revision: 167486

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167486
Log:
2010-12-06  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/46785
    * tree-vect-loop.c (vect_is_simple_reduction_1): Also allow
    call statements as operand definition.

    * gcc.dg/vect/fast-math-vect-reduc-9.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-9.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/46785] Doesn't vectorize reduction x += y*y
  2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-12-06 10:05 ` rguenth at gcc dot gnu.org
@ 2010-12-06 10:09 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-06 10:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46785

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-06 10:09:08 UTC ---
Fixed on trunk.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-06 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 14:54 [Bug tree-optimization/46785] New: Doesn't vectorize reduction x += y*y rguenth at gcc dot gnu.org
2010-12-03 15:39 ` [Bug tree-optimization/46785] " rguenth at gcc dot gnu.org
2010-12-05  8:31 ` irar at il dot ibm.com
2010-12-05 11:30 ` rguenth at gcc dot gnu.org
2010-12-06 10:05 ` rguenth at gcc dot gnu.org
2010-12-06 10:09 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).