public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mjr19 at cam dot ac.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/115563] New: Unnecessary brackets prevent fortran vectorisation
Date: Thu, 20 Jun 2024 17:56:15 +0000	[thread overview]
Message-ID: <bug-115563-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115563

            Bug ID: 115563
           Summary: Unnecessary brackets prevent fortran vectorisation
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mjr19 at cam dot ac.uk
  Target Milestone: ---

The code

subroutine foo(a,n)

  complex (kind(1d0)) :: a(*)
  integer :: i,n

!$OMP SIMD
  do i=1,n
     a(i)=(a(i)+(6d0,1d0))
  enddo

end subroutine foo

compiled with

$ gfortran-14 -S -O3 -ffast-math -fopenmp-simd  -mavx2 t3.f90

does not vectorise.

$ grep -c ymm t3.s 
0

If the extra brackets are removed, so that the loop line reads

     a(i)=a(i)+(6d0,1d0)

then it does.

$ grep -c ymm t3.s 
3

It seems surprising that the code produced should differ depending on whether
the brackets are present, as I do not believe that they alter the meaning of
the code in any way. One can construct many similar examples, e.g. using a
complex variable in the place of the (6d0,1d0), or using a real constant, etc.

             reply	other threads:[~2024-06-20 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 17:56 mjr19 at cam dot ac.uk [this message]
2024-06-20 18:01 ` [Bug fortran/115563] " pinskia at gcc dot gnu.org
2024-06-20 18:03 ` pinskia at gcc dot gnu.org
2024-06-20 18:04 ` pinskia at gcc dot gnu.org
2024-06-20 23:49 ` pinskia at gcc dot gnu.org
2024-06-21  8:58 ` mjr19 at cam dot ac.uk
2024-06-24 16:48 ` mjr19 at cam dot ac.uk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115563-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).