From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C59F3858C50; Tue, 27 Sep 2022 15:18:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C59F3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664291909; bh=16YveWX9Te1mygIVYTQPBvg8FC9gaZv3Hos+KTfR1s4=; h=From:To:Subject:Date:From; b=WkXD3hK43csgph4T4hkRo/T+qhBfmM94YEmjYECrmwM3GmwDug685UNDutvTIjcS2 mpKmZbLQQNHBDXyhXEt2Nzj0D+Dl96DxuNjDRNEQepzxywTTWj1sGYf5U2lbp6VrcW x5yCjCs1OxzQypIsxXM3x7uzvO873wkVWZ5O4Hm8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107052] New: Range of __builtin_popcount can be improved with nonzerobits Date: Tue, 27 Sep 2022 15:18:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D107052 Bug ID: 107052 Summary: Range of __builtin_popcount can be improved with nonzerobits Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` void link_failure(); void f(int a) { a &=3D 0x300; int b =3D __builtin_popcount(a); if (b > 3) link_failure(); } ``` The if statement should be optimized away as the only values for popcount h= ere is 0-3.=