From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47C163858C66; Tue, 6 Feb 2024 22:14:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47C163858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707257685; bh=q+KJrBiEc2ULc4gun9SjI026F1VSI1SBQcZzUwwGwkg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YjcbXX59ApkXfgvj8nfC7xDQWtDaaQE3ioky+KgF1gzWnUiNUWTV1QzUe06ty6fLm 97j2rVtAbrovZhiCEOHJpzOV5LaMkeOD/6qNMI5sXV2Fj+YRNDkYFm+uCoRMDWUgGV ubu0j5+UZ1wIIuVoj3f7Hw+oaDp1ksAe3yTee5d8= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/87744] Some valid instantiations of linear_congruential_engine produce compiler errors when __int128 isn't available Date: Tue, 06 Feb 2024 22:14:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 7.3.0 X-Bugzilla-Keywords: rejects-valid 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: 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=3D87744 --- Comment #11 from Jakub Jelinek --- (In reply to Jakub Jelinek from comment #10) > As discussed on IRC, probably the > if (!__builtin_mul_overflow(__l._M_lo, __x, &__lo)) > optimization isn't a good idea, because most likely the compiler will in > that case > expand that to a full 64x64->128 multiplication plus testing that the upp= er > 64 bits are or aren't zero, so computing everything this function needs a= nd > doing it again if there is overflow, without possibility to query what it > computed. Though, if it is common enough, one could try to optimize the __ll[0] =3D= =3D 0 && __xx[0] =3D=3D 0 case, one can do then either 32x32->64 or 64x64->64 multip= lication and be done with it. But if it is rare in random's usage, it would just ma= ke the code larger.=