From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B66E63858C78; Thu, 8 Feb 2024 13:54:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B66E63858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707400473; bh=nfFyY6WJvqQ6j8dX++Wrwy+7EvbJ7/0rDotE0gzJTms=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vdQS56pFGetEd42QWypP4fzzCXFfIbJUq+G9vKdKjUdeLWs74IFzPlZCTRNUssOUh LXkEOHpVgB2uqs7nV8TN0H6jbI90CsIqA17sDi3G+s6a595u3A7YgNMpHhupXRMWs+ OwExrG7yWu2WdZt/HWgjofXduhTdaWN0VMaOMYCs= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113774] wrong code with _BitInt() arithmetics at -O2 Date: Thu, 08 Feb 2024 13:54:32 +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: jakub 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: attachments.created 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=3D113774 --- Comment #4 from Jakub Jelinek --- Created attachment 57359 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57359&action=3Dedit gcc14-pr113774.patch So far lightly tested optimization on the bitint lowering side which emits more optimal code for that (for the unsigned 255 -> 257 bit extension and m_upwards_2limb low is 3 and high is 4, so when processing first limb in the loop, the idx < 3 condition is always true (as idx is 0 or 2) and when processing the second limb in the loop, similarly idxp1 <=3D 3 condition is always true (as idxp1 is 1 or 3) while idxp1 =3D=3D 3 still needs to be com= pared. This makes the PRE (or VN?) bug latent.=