From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E5893870C27; Tue, 14 May 2024 09:45:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E5893870C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715679901; bh=UQaXKN9GBC6SPKIqfz3MYn/Zs5WMLgwjKQHqASpUZ2M=; h=From:To:Subject:Date:From; b=JBeAnn8SNlYzMOwkgdZp7mETQlMzpvQRfgWdGUuNFu7vthw6sGMwEQqFT6dECpfK8 4VPB9qfGhJSdqqouu9dpOD5GGchMjTaMR5EnJjlQrm3dWYExX38GJOPXLeyVLoFPtT SWe6Sur1Rnj16knXPC+PREAKfz5CkWPTGJu6Ch6I= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115086] New: bic is not used when the non-not part is a constant Date: Tue, 14 May 2024 09:45:01 +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: 15.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=3D115086 Bug ID: 115086 Summary: bic is not used when the non-not part is a constant Product: gcc Version: 15.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: ``` int g2(int a,int c) { int b =3D 4 & ~c; return b; } ``` Currently GCC produces: ``` g2: mvn w0, w1 and w0, w0, 4 ret ``` But producing bic is better for most (if not all) modern cores due to the instruction that generates the constant would be "free". That is GCC should produce: ``` g2: mov w8, 4 bic w0, w8, w1 ret ``` Which is what clang/LLVM produces.=