From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1923) id 4E6B7384F6DB; Thu, 17 Nov 2022 22:25:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E6B7384F6DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668723954; bh=iLDOi9SQLxGmGCFz84SRQz5aCEDlUIvHc0Nedhot5Bk=; h=From:To:Subject:Date:From; b=LrMCe+/n5GVcZnKFd/ZlPrxQGtrufMeXFO3AwsJ0+tLLodmSz+sdgab6CTtJx83A4 DNNP2Ugud2eJUDpS1dF+KqOQ0cmkFQNZVXAZOV2gvrv2G63B6OlPBTeN/83eu7fNyw wmLrwZ4QDQu7u0KER+3ph774RcBhxraejTpLSwmY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Philipp Tomsich To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/vrull/heads/for-upstream)] RISC-V: Optimize masking with two clear bits not a SMALL_OPERAND X-Act-Checkin: gcc X-Git-Author: Philipp Tomsich X-Git-Refname: refs/vendors/vrull/heads/for-upstream X-Git-Oldrev: 289fd1a0b22bdcd5641711d3c662abd176a62d38 X-Git-Newrev: 5fdf1e0dcfc8ee3a6df645251be91b63e3347183 Message-Id: <20221117222554.4E6B7384F6DB@sourceware.org> Date: Thu, 17 Nov 2022 22:25:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5fdf1e0dcfc8ee3a6df645251be91b63e3347183 commit 5fdf1e0dcfc8ee3a6df645251be91b63e3347183 Author: Philipp Tomsich Date: Thu Oct 13 10:55:41 2022 +0200 RISC-V: Optimize masking with two clear bits not a SMALL_OPERAND Add a split for cases where we can use two bclri (or one bclri and an andi) to clear two bits. gcc/ChangeLog: * config/riscv/bitmanip.md (*bclri_nottwobits): New pattern. (*bclridisi_nottwobits): New pattern, handling the sign-bit. * config/riscv/predicates.md (const_nottwobits_operand): New predicate. gcc/testsuite/ChangeLog: * gcc.target/riscv/zbs-bclri.c: New test. Series-to: gcc-patches@gcc.gnu.org Series-cc: Palmer Dabbelt Series-cc: Vineet Gupta Series-cc: Christoph Muellner Series-cc: Kito Cheng Series-cc: Jeff Law Diff: --- gcc/config/riscv/predicates.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index 9058851df33..5ee1422364b 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -309,6 +309,11 @@ (match_test "ctz_hwi (INTVAL (op)) > 0") (match_test "SMALL_OPERAND (INTVAL (op) >> ctz_hwi (INTVAL (op)))"))) +;; A CONST_INT operand that has exactly two bits cleared. +(define_predicate "const_nottwobits_operand" + (and (match_code "const_int") + (match_test "popcount_hwi (~UINTVAL (op)) == 2"))) + ;; A CONST_INT operand that fits into the unsigned half of a ;; signed-immediate after the top bit has been cleared. (define_predicate "uimm_extra_bit_operand"