From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0591F3890431; Thu, 20 Jun 2024 17:56:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0591F3890431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718906176; bh=kfOIxYWKgjcPkcBbExC4m/iVQHbzLepvYvVVT0TDu0o=; h=From:To:Subject:Date:From; b=mtTp1KUuQiSUXM8EzpvCbEqsjO2a7IHAcLiF6GufHNNrB7AQ51+FcsXLC/vVpV/s9 vCg984na2mV1vtPBa9Dt/6a9WYPLm0uA6MfWAaUUGrAG+2SJgL0W7rTLeR4jHrZ3eN MiYOqUvHf86hl4y9mQahpgLnVu9UgiAeOOL2GTI0= From: "mjr19 at cam dot ac.uk" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 14.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjr19 at cam dot ac.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115563 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=3D1,n a(i)=3D(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=20 0 If the extra brackets are removed, so that the loop line reads a(i)=3Da(i)+(6d0,1d0) then it does. $ grep -c ymm t3.s=20 3 It seems surprising that the code produced should differ depending on wheth= er 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, e= tc.=