From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 68ACB3858D20; Sun, 25 Jun 2023 22:29:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68ACB3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687732190; bh=2mOwlejFm6wizvnC85TkiI+XCC5h28w+Gi+I0Daz03Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IswFLOPOIpJvfCeQNwM8oQd6LMSPNi3yqtXulQR44/8X7ZkrF84CcKYr9opnPd6tx 4o4wt90FCbSnTEqj/ZA7cguSWvP0thivkXAaQySb7gcPVmluzKcjnthaPr590DyP7O Re9YnBmFsdl/fN2B3BV/qYnypyi+FjS50W82ICKE= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94617] Simple if condition not optimized Date: Sun, 25 Jun 2023 22:29:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94617 --- Comment #10 from Andrew Pinski --- For the first function (vanilla_bandpass), GCC 12+ produces now: movq %rcx, %rax cmpl %edx, %edi jg .L2 cmpl %esi, %edx cmovl %r8, %rax .L2: ret For the second the problem is: _3 =3D ~within_interval_11; # RANGE [irange] long unsigned int [0, 1] NONZERO 0x1 _4 =3D (long unsigned intD.16) _3; ... low_ptr_13 =3D _4 * low.0_5; # RANGE [irange] long unsigned int [0, 1] NONZERO 0x1 _6 =3D (long unsigned intD.16) within_interval_11; ... high_ptr_15 =3D _6 * high.1_7; ptr_sum_16 =3D low_ptr_13 + high_ptr_15; We should recongize that ptr_sum_16 is really just within_interval_11 ? high.1_7 : low.0_5; Match pattern for that: ``` (for op (plus bit_ior bit_xor) (simplify (op:c (mult:c (convert @0) @1) (mult:c (convert (bit_not @0)) @2)) (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && TYPE_PRECISION (TREE_TYPE (@0)) =3D=3D 1 && TYPE_UNSIGNED (TREE_TYPE (@0))) (cond @0 @1 @2)) ```=