From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26112 invoked by alias); 19 May 2013 02:39:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26093 invoked by uid 48); 19 May 2013 02:39:44 -0000 From: "spam.brian.taylor at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57328] New: Missed optimization: Unable to vectorize Fortran min and max intrinsics Date: Sun, 19 May 2013 02:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: spam.brian.taylor at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg01254.txt.bz2 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