From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 447B2386F831; Mon, 27 Apr 2020 08:11:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 447B2386F831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587975066; bh=k1bZS/69oBc0J5FuHGrrPE1ZEJun3tpfp+oblj8WYVU=; h=From:To:Subject:Date:From; b=LMyfJT+qgt43WMVWQYOnC5Dk3woZVdPQK4r1ZFtXGJ91xGt1FfcTmgF6KR1lSaNIX fE3HKAP+Mk8/mtcI8qkAYs6ch5Gffvz30J3b8HDbkrTLj8NDmCR/pDvipJW+IV6KUz nZLsVPXmO2P7VliMofDurBsgdx8/ZmVvyzEAqXl4= From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94786] New: Missed min/max pattern using xor+and+less Date: Mon, 27 Apr 2020 08:11:06 +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: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail dot com 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 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 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: Mon, 27 Apr 2020 08:11:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94786 Bug ID: 94786 Summary: Missed min/max pattern using xor+and+less Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- int r1(int x, int y) { return y ^ ((x ^ y) & -(x < y)); } int r2(int x, int y) { return x ^ ((x ^ y) & -(x < y)); } `r1` can be optimized to `min` and `r2` to `max`. This transformation is do= ne by LLVM, but not by GCC. Comparison here: https://godbolt.org/z/hNhkqM=