From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3D9C8383F86B; Fri, 15 May 2020 03:27:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D9C8383F86B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589513232; bh=7JDblpdbU44xoX/b6wk6VrSWqbKemAZp5ax6hISLW5o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j8W7aD9JQ2gaKQKzc05dea0us9dLl0b4kIWCmnH2mkBsu2sTrDE2PbfAA7PAyBbsv Pd2aXQI+wmlMGS3ZeYIzgXlF0pc+TM5VMiAfB+sYSwoxd68J+vgZnScB1zAOEd2wVb z32yc3qyUxnm6L9/ii/qrt9tBERVZpj+g6CqPj30= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/61837] missed loop invariant expression optimization Date: Fri, 15 May 2020 03:27:11 +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: 5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit 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, 15 May 2020 03:27:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61837 --- Comment #11 from CVS Commits --- The master branch has been updated by Xiong Hu Luo : https://gcc.gnu.org/g:8a15faa730f99100f6f3ed12663563356ec5a2c0 commit r11-407-g8a15faa730f99100f6f3ed12663563356ec5a2c0 Author: Xionghu Luo Date: Thu May 14 21:03:24 2020 -0500 Fold (add -1; zero_ext; add +1) operations to zero_ext when not overflow(PR37451, PR61837) This "subtract/extend/add" existed for a long time and still annoying us (PR37451, part of PR61837) when converting from 32bits to 64bits, as the ctr register is used as 64bits on powerpc64, Andraw Pinski had a patch but caused some issue and reverted by Joseph S. Myers(PR37451, PR37782). Andraw: http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01070.html http://gcc.gnu.org/ml/gcc-patches/2008-10/msg01321.html Joseph: https://gcc.gnu.org/legacy-ml/gcc-patches/2011-11/msg02405.html We still can do the simplification from "subtract/zero_ext/add" to "zero_ext" when loop iterations is known to be LT than MODE_MAX (only do simplify when counter+0x1 NOT overflow). Bootstrap and regression tested pass on Power8-LE. gcc/ChangeLog 2020-05-15 Xiong Hu Luo PR rtl-optimization/37451, part of PR target/61837 * loop-doloop.c (doloop_simplify_count): New function. Simplify (add -1; zero_ext; add +1) to zero_ext when not wrapping. (doloop_modify): Call doloop_simplify_count. gcc/testsuite/ChangeLog 2020-05-15 Xiong Hu Luo PR rtl-optimization/37451, part of PR target/61837 * gcc.target/powerpc/doloop-2.c: New test.=