From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B6E4F385783F; Mon, 1 Jan 2024 12:42:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6E4F385783F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704112925; bh=zxNea9uJKfb0C2op6IcrWUhxqUuOpfzHJdW0txvQDo4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dYxHutECA2mZB0PkZy5c0VTWwf4fAowRY7e0TXfzJzY2l++8UNL8dB1YNh8rQXKg/ 7ahTiw0TcW6nYZFGb9w1J1Jvu18N1A4Hfuvvr+CdJHqkJiSnHO/7hK61rfmWs+OGxA +ylKPB1FK06q8JZXhoyV7FLXriPuUvPdaehqPznc= From: "piotrsiupa at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/90693] Missing popcount simplifications Date: Mon, 01 Jan 2024 12:41:57 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: piotrsiupa at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: wilco 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=3D90693 Piotr Siupa changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |piotrsiupa at gmail dot com --- Comment #8 from Piotr Siupa --- I did a benchmark and (x & (x-1)) =3D=3D 0 and it seems to be about 2x as f= ast as the currently generated code (at least on my AMD64 processor). Maybe it should be used if x is guaranteed to not be zero, e.g. if (x =3D= =3D 0) std::unreachable().=