From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B94063858D37; Tue, 24 Oct 2023 06:01:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B94063858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698127309; bh=q+ut59qv3m8yg6Mojqbq0byfKmLIhyy2vMt9o3qE/sQ=; h=From:To:Subject:Date:From; b=klOqjjCOddTV0+XM4jjl1eGOHYpZY7xFqdGODvaqy8evwa9U6gR+3X1Dd/M6YmERb xwtoRpyTSsguKTjH0Z3nU/txjcGNhzNSf0Mi7ibhDHV8co4Urj7tjWtSNWuZD9qq2+ m/3AXX2rgsG0gFbBKZKSELsXUbnD+UWINCWJqCpg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111949] New: combine split points are not so good with targets that have (and (not x) y) Date: Tue, 24 Oct 2023 06:01:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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 cf_gcctarget 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=3D111949 Bug ID: 111949 Summary: combine split points are not so good with targets that have (and (not x) y) Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: aarch64 Take: ``` bool f1(int a, bool b) { int c =3D a & b; return (c ^ a)&1; } ``` Currently GCC produces: ``` and w1, w1, 255 bic w0, w0, w1 and w0, w0, 1 ``` Notice how there are 2 and. If we look at combine dumps we will see: Trying 3, 8 -> 10: 3: r98:SI=3Dzero_extend(x1:QI) REG_DEAD x1:QI 8: r101:SI=3D~r98:SI&r103:SI REG_DEAD r98:SI REG_DEAD r103:SI 10: r102:SI=3Dr101:SI&0x1 REG_DEAD r101:SI Failed to match this instruction: (set (reg:SI 102) (and:SI (and:SI (not:SI (reg:SI 1 x1 [ b ])) (reg:SI 103)) (const_int 1 [0x1]))) Successfully matched this instruction: (set (reg:SI 101) (not:SI (reg:SI 1 x1 [ b ]))) Failed to match this instruction: (set (reg:SI 102) (and:SI (and:SI (reg:SI 101) (reg:SI 103)) (const_int 1 [0x1]))) The first part is good but the second part is not so good and shows that combine not finding a good split point and using: (and:SI (not:SI (reg:SI 1 x1 [ b ])) (reg:SI 103)) as the point how to split the above instruction. (note I don't know if this should be a generic change or a target specific = one off hand, just filing it to keep track of what missed optimization I found)= .=