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] Unnecessary brackets prevent fortran vectorisation Date: Mon, 24 Jun 2024 16:48:33 +0000 [thread overview] Message-ID: <bug-115563-4-3JMbTPXfWA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-115563-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115563 --- Comment #6 from mjr19 at cam dot ac.uk --- A further comment to aid others reading this report. It is not just unnecessary brackets which used to prevent vectorisation, but also necessary ones. subroutine foo(a,b,c,n) complex (kind(1d0)) :: a(*),b,c integer :: i,n do i=1,n a(i)=(a(i)+b)*c enddo end subroutine foo does not vectorise with gfortran-14, but does with gfortran-15.0-20240623. The performance increase in loops making extensive use of complex variables can therefore be quite significant -- fifty percent or more. The almost-equivalent C code of void foo(_Complex double *a, _Complex double b, _Complex double c, int n){ int i; for(i=0;i<n;i++) a[i]=(a[i]+b)*c; } does vectorise with gcc-14 (and earlier versions). I still find gfortran to be slower than ifort for code using complex variables, as ifort is better at flipping alternate signs in a vector and generally alternating nops in a vector, see PR 114324 and PR 114767, but this is a very welcome improvement. Many thanks.
prev parent reply other threads:[~2024-06-24 16:48 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-20 17:56 [Bug fortran/115563] New: " 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 message]
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-3JMbTPXfWA@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: linkBe 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).