From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BB1A3858422; Thu, 7 Sep 2023 07:59:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BB1A3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694073554; bh=NDsUeyhyyqAdCyc61piBIqyqNVVFMCcyKsoRGtWiYn8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Nt/ho4b3Ixr+NacwUOPYqtEXZB3WuHYTASFwAjAkq5NCT2RxbX07EyS5DOqT9Tlmf 0ILi42hT/JtbUPlGy/xkvQvlWA5AE3ynyd5yDFmsCmXRITYR++ibrw29aE51lv1HTV lYXH75X0q+JlD6E7ZKJpWvuh7L+Uvq3PVSFa5LdU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111252] LoongArch: Suboptimal code for (a & ~mask) | (b & mask) where mask is a constant with value ((1 << n) - 1) << m Date: Thu, 07 Sep 2023 07:59:13 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit 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=3D111252 --- Comment #6 from CVS Commits --- The master branch has been updated by Xi Ruoyao : https://gcc.gnu.org/g:5b857e87201335148f23ec7134cf7fbf97c04c72 commit r14-3773-g5b857e87201335148f23ec7134cf7fbf97c04c72 Author: Xi Ruoyao Date: Tue Sep 5 19:42:30 2023 +0800 LoongArch: Use bstrins instruction for (a & ~mask) and (a & mask) | (b & ~mask) [PR111252] If mask is a constant with value ((1 << N) - 1) << M we can perform this optimization. gcc/ChangeLog: PR target/111252 * config/loongarch/loongarch-protos.h (loongarch_pre_reload_split): Declare new function. (loongarch_use_bstrins_for_ior_with_mask): Likewise. * config/loongarch/loongarch.cc (loongarch_pre_reload_split): Implement. (loongarch_use_bstrins_for_ior_with_mask): Likewise. * config/loongarch/predicates.md (ins_zero_bitmask_operand): New predicate. * config/loongarch/loongarch.md (bstrins__for_mask): New define_insn_and_split. (bstrins__for_ior_mask): Likewise. (define_peephole2): Further optimize code sequence produced by bstrins__for_ior_mask if possible. gcc/testsuite/ChangeLog: * g++.target/loongarch/bstrins-compile.C: New test. * g++.target/loongarch/bstrins-run.C: New test.=