From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 92C563858C2C; Wed, 5 Jan 2022 07:43:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92C563858C2C From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103903] Loops handling r,g,b values are not vectorized to use power of 2 vectors even if they can Date: Wed, 05 Jan 2022 07:43:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: Wed, 05 Jan 2022 07:43:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103903 --- Comment #2 from Richard Biener --- If you fix the loop to do for (i=3D0;i<100000;i++) { dest[i].r/=3Dsrc[i].g; dest[i].g/=3Dsrc[i].g; dest[i].b/=3Dsrc[i].b; } it's vectorized just fine (with larger than necessary VF): .L2: movaps dest+16(%rax), %xmm1 movaps dest+32(%rax), %xmm0 addq $48, %rax divps src-32(%rax), %xmm1 movaps dest-48(%rax), %xmm2 divps src-16(%rax), %xmm0 divps src-48(%rax), %xmm2 movaps %xmm1, dest-32(%rax) movaps %xmm2, dest-48(%rax) movaps %xmm0, dest-16(%rax) cmpq $1200000, %rax jne .L2 so not sure what you are asking for? Is the unrolling harmful? It should be doable to do the "re-rolling" on the fly in some cases but it might be some work to tie that in.=