From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA1C83858012; Tue, 9 Jan 2024 14:12:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA1C83858012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704809549; bh=7xZN0RRv53O00aEEVO56yachaS/5RphoauDSW9TiH2A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=x8Lay//xgvtnEOiZFRE0rVhM9JbW6fzeeqktxhoHI3Spb1nnzDzTcG8tb+dfPxmI2 fT5tt03Srk5z1oE5pubWFLVVp4eTsEiyzWJFwJDPQAIOBw3RvSLUzV4A4CzdPgyfx2 4b0u46ITLkXEpVMIDiPO4D44SK1g35bj4vSIcJS8= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/113287] wrong code with __builtin_mul_overflow_p() and _BitInt() with -O3 -msse4 Date: Tue, 09 Jan 2024 14:12:29 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: cc 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=3D113287 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |tnfchris at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- Comparing the arguments of the __mulbitint3 call between -O3 -msse4 and -O3 -msse4 -fno-tree-vectorize shows that the arguments to that call are comput= ed right even when vectorizing, (_BitInt(9020)) 5 << 1128, 5 and seems there is some bug in the vectorization of the loop trying to check if the result of = the __mulbitint3 fits into signed int (which it doesn't). That is done by checking if the least significant limb (unsigned long) ((signed long) res[0] >> 31) > 1UL (that is not the case, t= he least significant limb is actually 0), then comparing the next 140 array elements against (unsigned long) ((signed long) res[0] >> 31) (one of them is different) and finally if none is different, compare (long) (res[141] << 60) >> 60 against it too. So, I believe this is a bug in the vectorizer part Tamar is changing right = now.=