From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D5EE384605A; Tue, 20 Jul 2021 23:44:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D5EE384605A From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/85234] missed optimisation opportunity for (~x >> CST)!=0 is not optimized to (((unsigned)x) < ~((1< 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 23:44:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85234 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|missed optimisation |missed optimisation |opportunity for (~x >> n) ? |opportunity for (~x >> |a : b with n, a, b |CST)!=3D0 is not optimized= to |constants | (((unsigned)x) < | |~((1< --- int f(int x) { return (~x >> 3) !=3D0; } int f2(int x) { return (((unsigned)x) < ~((1<<3) - 1)); } The above is what LLVM does really=