From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A94B0385702B; Tue, 4 Aug 2020 11:21:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A94B0385702B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596540085; bh=HoG+/ZHcGr57HCpmakzbbBeCOVRJ/w/5AtJJMkTZDNM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uidIbuIWq6DPrOIjD4ILLcGlKNdegJS54k6zeEm/xnYdRolEc9Ca9CgVJcj5SsF7u nubbgb+haBz1lF5tHclc34jjENcOqA0QoaEOI+hFeh4+Tu0ThkIigLV/iPCpieU7mj OflL142XvONE+cVwQrklzERLNLO0YBEbBmeYcNzg= From: "wilco at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95731] Faiilure to optimize a >= 0 && b >= 0 to (a | b) >= 0 Date: Tue, 04 Aug 2020 11:21:25 +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: 11.0 X-Bugzilla-Keywords: easyhack, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: wilco at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_status cf_reconfirmed_on cc everconfirmed 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 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, 04 Aug 2020 11:21:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95731 Wilco changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-08-04 CC| |wilco at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #3 from Wilco --- (In reply to Gabriel Ravier from comment #0) > bool f(int a, int b) > { > return a >=3D 0 && b >=3D 0; > } >=20 > This can be optimized to `return (a | b) >=3D 0;`. LLVM does this > transformation, but GCC does not. For orthogonality you also want: a < 0 && b < 0 -> (a & b) < 0 a >=3D 0 || b >=3D 0 -> (a & b) >=3D 0 a < 0 || b < 0 -> (a | b) < 0=