public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/43184]  New: gcc could not vectorize floating point reduction statements
@ 2010-02-25 23:54 changpeng dot fang at amd dot com
  2010-02-25 23:58 ` [Bug middle-end/43184] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-02-25 23:54 UTC (permalink / raw)
  To: gcc-bugs

gcc 4.5 could not vectorize floating point reductions.
float sum(float a[], int n) {
 int i;
 float total=0.0;
 for(i=0; i< n; i++)
  total += a[i];
 return total;
}

"gcc -O3 -fdump-tree-vect-all" shows:
foo.c:4: note: Unsupported pattern.
foo.c:4: note: not vectorized: unsupported use in stmt.
foo.c:4: note: unexpected pattern.
foo.c:1: note: vectorized 0 loops in function.

I have verified that gcc can vectorize integer reduction, but not float and
double.


-- 
           Summary: gcc could not vectorize floating point reduction
                    statements
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: changpeng dot fang at amd dot com


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


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

* [Bug middle-end/43184] gcc could not vectorize floating point reduction statements
  2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
@ 2010-02-25 23:58 ` pinskia at gcc dot gnu dot org
  2010-02-26  0:28 ` changpeng dot fang at amd dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-25 23:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-02-25 23:57 -------
>gcc 4.5 could not vectorize floating point reductions.

Yes it can; add -ffast-math.  floating point reductions need -ffast-math as it
can change the results in some cases (negative zero and I think clamping cases
too).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug middle-end/43184] gcc could not vectorize floating point reduction statements
  2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
  2010-02-25 23:58 ` [Bug middle-end/43184] " pinskia at gcc dot gnu dot org
@ 2010-02-26  0:28 ` changpeng dot fang at amd dot com
  2010-02-26  0:47 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-02-26  0:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from changpeng dot fang at amd dot com  2010-02-26 00:28 -------
Subject: RE:  gcc could not vectorize floating point
 reduction statements

Thanks for pointing this out. Actually I am working on a fortran program and
found the
the reduction statement.  The fortran code can not be vectorized even with
-ffast-math.
Do you think this is the problem of fortran frontend? Thanks, -- Changpeng

c%3.1
      subroutine s311 (ntimes,ld,n,ctime,dtime,a,b,c,d,e,aa,bb,cc)
c
c     reductions
c     sum reduction
c
      integer ntimes, ld, n, i, nl
      double precision a(n), b(n), c(n), d(n), e(n), aa(ld,n),
     +                 bb(ld,n), cc(ld,n)
      double precision chksum, sum
      real t1, t2, second, ctime, dtime

      call init(ld,n,a,b,c,d,e,aa,bb,cc,'s311 ')
      t1 = second()
      do 1 nl = 1,ntimes
      sum = 0.d0
      do 10 i = 1,n
         sum = sum + a(i)
  10  continue
      call dummy(ld,n,a,b,c,d,e,aa,bb,cc,sum)
  1   continue
      t2 = second() - t1 - ctime - ( dtime * float(ntimes) )
      chksum = sum
      call check (chksum,ntimes*n,n,t2,'s311 ')
      return
      end



________________________________________
From: pinskia at gcc dot gnu dot org [gcc-bugzilla@gcc.gnu.org]
Sent: Thursday, February 25, 2010 5:57 PM
To: Fang, Changpeng
Subject: [Bug middle-end/43184] gcc could not vectorize floating point
reduction statements

------- Comment #1 from pinskia at gcc dot gnu dot org  2010-02-25 23:57
-------
>gcc 4.5 could not vectorize floating point reductions.

Yes it can; add -ffast-math.  floating point reductions need -ffast-math as it
can change the results in some cases (negative zero and I think clamping cases
too).


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.


-- 


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


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

* [Bug middle-end/43184] gcc could not vectorize floating point reduction statements
  2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
  2010-02-25 23:58 ` [Bug middle-end/43184] " pinskia at gcc dot gnu dot org
  2010-02-26  0:28 ` changpeng dot fang at amd dot com
@ 2010-02-26  0:47 ` pinskia at gcc dot gnu dot org
  2010-02-26 13:20 ` manu at gcc dot gnu dot org
  2010-02-26 13:21 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-26  0:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2010-02-26 00:47 -------
t.f:15: note: not vectorized: unsupported use in stmt.
(In reply to comment #2)
> Subject: RE:  gcc could not vectorize floating point
>  reduction statements
> 
> Thanks for pointing this out. Actually I am working on a fortran program and
> found the
> the reduction statement. 

And that is PR 32824 (which I filed awhile back).


-- 


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


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

* [Bug middle-end/43184] gcc could not vectorize floating point reduction statements
  2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
                   ` (2 preceding siblings ...)
  2010-02-26  0:47 ` pinskia at gcc dot gnu dot org
@ 2010-02-26 13:20 ` manu at gcc dot gnu dot org
  2010-02-26 13:21 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-26 13:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-02-26 13:20 -------
So this is not invalid...


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug middle-end/43184] gcc could not vectorize floating point reduction statements
  2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
                   ` (3 preceding siblings ...)
  2010-02-26 13:20 ` manu at gcc dot gnu dot org
@ 2010-02-26 13:21 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-26 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2010-02-26 13:20 -------
,,. but a duplicate 

*** This bug has been marked as a duplicate of 32824 ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-02-26 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 23:54 [Bug middle-end/43184] New: gcc could not vectorize floating point reduction statements changpeng dot fang at amd dot com
2010-02-25 23:58 ` [Bug middle-end/43184] " pinskia at gcc dot gnu dot org
2010-02-26  0:28 ` changpeng dot fang at amd dot com
2010-02-26  0:47 ` pinskia at gcc dot gnu dot org
2010-02-26 13:20 ` manu at gcc dot gnu dot org
2010-02-26 13:21 ` manu at gcc dot gnu dot 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).