public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57328] New: Missed optimization: Unable to vectorize Fortran min and max intrinsics
@ 2013-05-19  2:39 spam.brian.taylor at gmail dot com
  2013-05-21  1:03 ` [Bug fortran/57328] " bdavis at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: spam.brian.taylor at gmail dot com @ 2013-05-19  2:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57328
           Summary: Missed optimization: Unable to vectorize Fortran min
                    and max intrinsics
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: spam.brian.taylor at gmail dot com

Created attachment 30145
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30145&action=edit
Test case for vectorization of loops containing max and if

Use of the Fortran min or max intrinsic functions within a loop appears to
prevent vectorization of the loop.  Replacement of min or max with conditional
assignment using if statements allows vectorization.

A simple test case using max is attached.  If compiled with "gfortran -O2
-msse2 -ftree-vectorize -ftree-vectorizer-verbose=1 -c max_vs_ifs_in_loop.F90",
I get (with extraneous output snipped):

...
max_vs_ifs_in_loop.F90:1: note: vectorized 0 loops in function.
...
max_vs_ifs_in_loop.F90:17: note: LOOP VECTORIZED.
...


gfortran should be able to vectorize loops containing min or max, using any
number of arguments to these intrinsics, e.g. "tmp = max(r1, r2, r3, r4)".


Compiler info:
user@host $ gfortran --version
GNU Fortran (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING


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

end of thread, other threads:[~2014-05-19  8:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-19  2:39 [Bug fortran/57328] New: Missed optimization: Unable to vectorize Fortran min and max intrinsics spam.brian.taylor at gmail dot com
2013-05-21  1:03 ` [Bug fortran/57328] " bdavis at gcc dot gnu.org
2013-05-21  7:08 ` burnus at gcc dot gnu.org
2013-05-21  9:16 ` rguenth at gcc dot gnu.org
2013-05-21  9:56 ` glisse at gcc dot gnu.org
2013-05-21 10:16 ` jakub at gcc dot gnu.org
2013-05-21 11:21 ` glisse at gcc dot gnu.org
2013-05-21 18:17 ` spam.brian.taylor at gmail dot com
2013-05-21 20:25 ` bdavis at gcc dot gnu.org
2013-05-21 21:25 ` [Bug tree-optimization/57328] " glisse at gcc dot gnu.org
2013-05-22 14:22 ` glisse at gcc dot gnu.org
2013-06-13 20:29 ` glisse at gcc dot gnu.org
2014-05-19  8: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).