From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA2623954C67; Tue, 4 Jun 2024 14:17:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA2623954C67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717510661; bh=PBSIh/FsKySHhbGAsYsE26ieVTnMl33OimAX4SN8YeQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=w1rHVRDjrK1TzKMsYA7zS0xtJvxxf7KsZHzDkGR8J+HPICJ/k2dQu69Vkr7xavt3s mA0oZsWJeARidTQnJ148V5Zq4THvC4pEQ3UCzKrDWBigG18pFQFLUTzxTxWcdSj5KR mIFKMFH9gRwsOCAZxiyRCp7+6AtKCiJrKNzMG94Q= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115337] wrong code with _BitInt() __builtin_stdc_first_leading_one/__builtin_clzg (with -1 as second arg) at -O2 Date: Tue, 04 Jun 2024 14:17:41 +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: 15.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=3D115337 --- Comment #10 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:591d30c5c97e757f63ce0d99ae9a3dbe8c75a50a commit r15-1014-g591d30c5c97e757f63ce0d99ae9a3dbe8c75a50a Author: Jakub Jelinek Date: Tue Jun 4 16:16:49 2024 +0200 ranger: Improve CLZ fold_range [PR115337] cfn_ctz::fold_range includes special cases for the case where .CTZ has two arguments and so is well defined at zero, and the second argument is equal to prec or -1, but cfn_clz::fold_range does that only for the prec case. -1 is fairly common as well though, because the built= ins do use it now, so I think it is worth special casing that. If we don't know anything about the argument, the difference for .CLZ (arg, -1) is that previously the result was varying, now it will be [-1, prec-1]. If we knew arg can't be zero, it used to be optimized be= fore as well into e.g. [0, prec-1] or similar. 2024-06-04 Jakub Jelinek PR tree-optimization/115337 * gimple-range-op.cc (cfn_clz::fold_range): For m_gimple_call_internal_p handle as a special case also second argument of -1 next to prec.=