From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 08A863858C31; Sun, 28 May 2023 23:05:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08A863858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685315141; bh=6i7koPg0Ufi3rNs8cKZ8VfPe/8DdvpxzI/khmqcQNhk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W1oQt8tLBXHC9ogd4YyOFUzV0difCz9ScP8Z5FDf4P9PzZT1io6ELM4Lm2qHWm/3h zEqXr9LSUrt8c63SKeaisNWP1ZGXz65oZYSLea4CReHGYkMjkr2ixdnicH7Q+hIPW0 oVKS8Ty/KrUxuuX6K94vlTjOVhfs7SooB0NidROw= 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85234 --- Comment #5 from Andrew Pinski --- Here is the testcase for the constants besides 0:L ``` #define N 3 #define unsigned int #define cmp =3D=3D #define M 0xf0000000u _Bool f(unsigned x, int t) { return (x << N) cmp (M << N); } _Bool f1(unsigned x, int t) { return ((x^M) & (-1u>>N)) cmp 0; } _Bool f2(unsigned x, int t) { return (x & (-1u>>N)) cmp (M & (-1u>>N)); } _Bool g(unsigned x, int t) { return (x >> N) cmp M; } _Bool g2(unsigned x, int t) { _Bool tttt =3D 0; if (tttt) return 0; return (x & (-1u<=3D (1u<