From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AA903395B454; Wed, 2 Dec 2020 10:41:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA903395B454 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/97459] __uint128_t remainder for division by 3 Date: Wed, 02 Dec 2020 10:41:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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, 02 Dec 2020 10:41:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97459 --- Comment #24 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:037fe26ee1ac18581bf0ad646d48591c97d10bd3 commit r11-5648-g037fe26ee1ac18581bf0ad646d48591c97d10bd3 Author: Jakub Jelinek Date: Wed Dec 2 11:32:19 2020 +0100 expansion: Further improve double-word modulo, division and divmod [PR97459] The following patch implements what Thomas wrote about, in particular that we can handle also double-word divison by the constants for which the earlier patch optimized modulo (if it would be otherwise a library call) and that we can also easily handle such constants shifted to the left. Unfortunately, seems CSE isn't able to optimize away the two almost identical sequences (one to compute remainder, one to compute quotient), probably because of the ADD_OVERFLOW introduced jumps, so the patch also adjusts expand_DIVMOD. 2020-12-02 Jakub Jelinek PR rtl-optimization/97459 * optabs.h (expand_doubleword_divmod): Declare. * optabs.c (expand_doubleword_divmod): New function. (expand_binop): Use it. * internal-fn.c (expand_DIVMOD): Likewise. * gcc.target/i386/pr97282.c (foo): Use 123456 divisor instead of 10. * gcc.dg/pr97459-1.c (TESTS): Add tests for 10, 12 and 6144. * gcc.dg/pr97459-2.c (TESTS): Likewise. * gcc.dg/pr97459-3.c: New test. * gcc.dg/pr97459-4.c: New test. * gcc.dg/pr97459-5.c: New test. * gcc.dg/pr97459-6.c: New test.=