From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 80CFC3858428; Wed, 17 Jan 2024 13:44:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80CFC3858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705499069; bh=RvPERlOAl+VnjwOqRKC8WPu/GuuaUwRD/TKhBR9cvR4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=itccnFubwMBgG46gUOTdO+iE1bmdbaw+RSapa2Dm5liFwN6hOvOB7iX7Y0xXzYdQN +DVWnodXFM0NOGSm7XOFHWZfjSFWaMZbtFeqghxKOk9Bqtls4ddco5TQzhjd8QWDXq /aSGYW1/4Aj/6bRKSDETqKkOHULsDyhcWBFPC+dk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113421] wrong code with -O -fno-tree-fre and _BitInt() multiplication Date: Wed, 17 Jan 2024 13:44:26 +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: wrong-code 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113421 --- Comment #2 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:9f8ba332e988fb582f6ca32465f6d65283f53b3a commit r14-8186-g9f8ba332e988fb582f6ca32465f6d65283f53b3a Author: Jakub Jelinek Date: Wed Jan 17 14:43:40 2024 +0100 lower-bitint: Avoid overlap between destinations and sources in libgcc calls [PR113421] The following testcase is miscompiled because the bitint lowering emits= a .MULBITINT (&a, 1024, &a, 1024, &x, 1024); call. The bug is in the overlap between the destination and source, th= at is something the libgcc routines don't handle, they use the source arrays during the entire algorithms which computes the destination array(s). For the mapping of SSA_NAMEs to VAR_DECLs the code already supports that correctly, but the checking whether a load from memory can be used dire= ctly without a temporary even when earlier we decided to merge the multiplication/division/modulo etc. with a store didn't. The following patch implements that. 2024-01-17 Jakub Jelinek PR tree-optimization/113421 * gimple-lower-bitint.cc (stmt_needs_operand_addr): Adjust func= tion comment. (bitint_dom_walker::before_dom_children): Add g temporary to simplify formatting. Start at vop rather than cvop even if stmt is a st= ore and needs_operand_addr. * gcc.dg/torture/bitint-50.c: New test.=