From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DC86385B525; Thu, 6 Jul 2023 16:05:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DC86385B525 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688659532; bh=NB22LNyqxRB2DCpz5dBj+ZWfV77uKaxpfXl6c9dRYzk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KPWATdV22gdqujcSyoCgaMaw7QEZMJLMZ+yd5lOCBBfm0fkTpVkgEumOc61bxEEsx GTU3c2OCSgE6oEHMROykcY5u9JfvDbaxGG/Qp6wxk2mC9Q72wrJAXZPH3XBbGlOu26 dnBl3DSVPlD5O9Xj5aHVm9WRX5KzyBN2zxrY/KAY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110449] Vect: use a small step to calculate the loop induction if the loop is unrolled during loop vectorization Date: Thu, 06 Jul 2023 16:05:31 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110449 --- Comment #3 from CVS Commits --- The master branch has been updated by Jeff Law : https://gcc.gnu.org/g:224fd59b2dc8a5fa78a309a09863afe9b3cf2111 commit r14-2367-g224fd59b2dc8a5fa78a309a09863afe9b3cf2111 Author: Hao Liu OS Date: Thu Jul 6 10:04:46 2023 -0600 Vect: use a small step to calculate induction for the unrolled loop (PR tree-optimization/110449) If a loop is unrolled by n times during vectoriation, two steps are use= d to calculate the induction variable: - The small step for the unrolled ith-copy: vec_1 =3D vec_iv + (VF/n * Step) - The large step for the whole loop: vec_loop =3D vec_iv + (VF * Step) This patch calculates an extra vec_n to replace vec_loop: vec_n =3D vec_prev + (VF/n * S) =3D vec_iv + (VF/n * S) * n =3D vec_l= oop. So that we can save the large step register and related operations. gcc/ChangeLog: PR tree-optimization/110449 * tree-vect-loop.cc (vectorizable_induction): use vec_n to repl= ace vec_loop for the unrolled loop. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr110449.c: New testcase.=