From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 429073857406; Wed, 25 Aug 2021 11:52:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 429073857406 From: "wschmidt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102062] powerpc suboptimal unrolling simple array sum Date: Wed, 25 Aug 2021 11:52:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wschmidt at gcc dot gnu.org 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: cc 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: Wed, 25 Aug 2021 11:52:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102062 Bill Schmidt changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wschmidt at gcc dot gnu.org --- Comment #1 from Bill Schmidt --- Regarding the latter question, I'm surprised it's not being done. This behavior is controlled by -fvariable-expansion-in-unroller, which was enabl= ed by default for PowerPC targets a couple of releases back. You reported this against GCC 11.2, but I'm skeptical. What options are you using? Compiling with -O2 and current trunk, I see variable expansion kicking in, = and I also see the same base register in use in all references in the loop: test: .LFB0: .cfi_startproc .localentry test,1 slwi 4,4,1 li 10,0 li 7,0 addi 9,3,-4 extsw 4,4 andi. 6,4,0x3 addi 5,4,-1 mr 8,4 beq 0,.L9 cmpdi 0,6,1 beq 0,.L13 cmpdi 0,6,2 bne 0,.L22 .L14: lwzu 6,4(9) addi 4,4,-1 add 10,10,6 .L13: lwzu 6,4(9) cmpdi 0,4,1 add 10,10,6 beq 0,.L19 .L9: srdi 8,8,2 mtctr 8 .L2: lwz 4,4(9) lwz 5,12(9) lwz 6,8(9) lwzu 8,16(9) add 10,4,10 add 10,10,5 add 7,6,7 add 7,7,8 bdnz .L2 .L19: add 3,10,7 extsw 3,3 blr .p2align 4,,15 .L22: lwz 10,0(3) mr 9,3 mr 4,5 b .L14=