From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C4B453858D33; Tue, 7 Nov 2023 03:34:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4B453858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699328084; bh=BpYMDNuhtbUQtkYAQEhlSZBKaSF1smkfz+sfiyQ+kXM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=C9uHprELeIBgC3GSrwClzVqABMovnUe1nsMbVBW+7E2wgyT9iyKd76C3FXBff/uNE PPHFXzRILxt0qwSV8P6xUFPNKY5iOOmxGJ19A9r0Z0cwkrE6N+1zUZXl1XXuOuYe3w EShZiGJdShaTjMImoOumQGjF1KOBiJyIJ2b6dqd4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112382] `(a&b) != a` where a is known to have one known bit set is not optimized to ((~b&a)>>shift) & 1 Date: Tue, 07 Nov 2023 03:34:44 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: 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=3D112382 --- Comment #2 from Andrew Pinski --- (In reply to Richard Biener from comment #1) > Note ((~b&a)>>shift) & 1 is two more GIMPLE ops than (a&b) !=3D a so I'd > expect the reverse transform on GIMPLE and maybe target specific expansion > tweaks (or combine at work). Right, that is why I put the component as middle-end. Specifically because I think `(a&b) !=3D a` should be the Canonical form and only expanded either = in isel or expand .=