From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B60138708EB; Tue, 9 Apr 2024 23:03:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B60138708EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712703830; bh=CeJEPZ/hc2NvnF2rvWVjNpmVCLA7j+eVZueNw8zUFGw=; h=From:To:Subject:Date:From; b=fX2FDwXndf4eYi5f5ffOfp6j7MwN7SsP1jI4GG3uPRDwC7RFPLn6xAVNUcWfadZWQ heAVN9xJ5CL49sEBK2TQMNsfNc3n+fivw6DJ9mu8oor+5XrvSb4UV13vt8SlmMTZAP diPXU+/oDiRnZbZVwGhkxVIuix1AjHmYZKOSqWqM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114670] New: `(a ^ 1) <= 3` can be optimized to `a <= 3` Date: Tue, 09 Apr 2024 23:03:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D114670 Bug ID: 114670 Summary: `(a ^ 1) <=3D 3` can be optimized to `a <=3D 3` Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- While looking into PR 114666, I noticed this: ``` int f(unsigned a) { return (a^1) <=3D 3; } int fa(unsigned a) { return (a) <=3D 3; } ``` These 2 are the same functions should produce the same code. Basically if we have `(a ^ CST1) <=3D MASK` where MASK is a (lower) mask wh= ich contain the bits of CST1.=