From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 72E80385781D; Fri, 20 Aug 2021 11:52:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72E80385781D From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95962] Inefficient code for simple arm_neon.h iota operation Date: Fri, 20 Aug 2021 11:52:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 11:52:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95962 --- Comment #2 from rsandifo at gcc dot gnu.org --- (In reply to Tamar Christina from comment #1) > We generate the correct code at -O3 but not -O2. >=20 > At -O3 we generate >=20 > foo: > adrp x0, .LC0 > sub sp, sp, #16 > ldr q0, [x0, #:lo12:.LC0] > add sp, sp, 16 > ret >=20 > where the problem seems to be at at -O2 store merging has broken up the > construction of `array` into two separate memory accesses: >=20 > MEM [(int *)&array] =3D 4294967296; > MEM [(int *)&array + 8B] =3D 12884901890; >=20 > whereas at -O3 we still have a single assignment: >=20 > MEM [(int *)&array] =3D { 0, 1, 2, 3 }; >=20 > I'm not sure even if we made these loads gimple level if that would help. > we'd still have the explicit MEMs created by store merging. If we folded them to gimple loads, the gimple optimisers should replace the MEM with an assignment of the VECTOR_CST { 0, 1, 2, 3 } to an SSA name, with the function returning the SSA name. expand will convert this back into a memory access, in the form of an RTL constant pool load. But that will avoid the stack temporary and thus the pointless stack adjustments.=