From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACB663858D33; Mon, 4 Mar 2024 16:42:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACB663858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709570557; bh=Cqznl89aWINAbxwhw/8J9necRk4wVlqCfLEcX8iRPgk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PcslB/K+FdKuR7DrIcpNUYfkrQsjA9GVpUC1zq9yInQJZ9N+F2VTymy76CQAlXVIh GEYSfqswB7yHka+qmtZ03vZWMGIEx0e+gEEcwXY0GGUTWx3vLw5FF4z0DcX9KUhR1c P4H0MqNvYUbOlI1uaq07BuvVjXArmw/MaEHHZhmY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94787] Failure to detect single bit popcount pattern Date: Mon, 04 Mar 2024 16:42:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D94787 --- Comment #7 from Andrew Pinski --- And add: ``` int h(int a) { if (a =3D=3D 0) return 0; return __builtin_popcount(a) =3D=3D 1; } int h1(int a) { if (a =3D=3D 0) return 1; return __builtin_popcount(a) =3D=3D 1; } ``` h should be just `__builtin_popcount(a) =3D=3D 1`. While h1 should be just `__builtin_popcount(a) <=3D 1`.=