public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115563] New: Unnecessary brackets prevent fortran vectorisation
@ 2024-06-20 17:56 mjr19 at cam dot ac.uk
  2024-06-20 18:01 ` [Bug fortran/115563] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mjr19 at cam dot ac.uk @ 2024-06-20 17:56 UTC (permalink / raw)
  To: gcc-bugs

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.

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

end of thread, other threads:[~2024-06-24 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 17:56 [Bug fortran/115563] New: Unnecessary brackets prevent fortran vectorisation mjr19 at cam dot ac.uk
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

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).