From patchwork Mon Apr 10 10:56:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Sinan X-Patchwork-Id: 81460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1810874vqo; Mon, 10 Apr 2023 03:57:58 -0700 (PDT) X-Google-Smtp-Source: AKy350b+Tw9/WOXy8in3lwF3QnrAX+tCsrpOg+V4iDjrgC66k+AE52ySsskoMcicRxALIEX5q/9x X-Received: by 2002:a17:906:b282:b0:932:e6d5:bd7c with SMTP id q2-20020a170906b28200b00932e6d5bd7cmr6447324ejz.20.1681124278709; Mon, 10 Apr 2023 03:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681124278; cv=none; d=google.com; s=arc-20160816; b=CYZjB6cGhXnAFOXsRrPRzbEDbTUBUq+goa25YUi9dVEE17ASAnX1nUdRqkRHkkeZD0 2LVkENEhRUoTsWsL3vbXzHORhneCRLOmJ2STLJ5gNwHMmrxbxNgdc8qlzkG7J9Av7rGc ZXBAVQ9HpylHRyTjc6IdFeiq2EbXYXe5oiGWliTBYzpOvflXEKob3Lui01NG7F6tq9+A Dlss6BZmhDtoG/7ybO5Nr8gPHmxYn1IsQVwSAfC/GSLioaauSlZT7gGCNp0icPRHo0GO x+3mrYmkOnGSSB+f0kpoLZfYYSVJ3zup6JdGFYcgceEBXOqGSrGYB7YqEYf9OvUaV9X1 mFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=FppgRun1m6M32ftK2gKw+pstH7ClD6SkNtBCUDciW/k=; b=oEwnMzWnkm2NgN67wC4fCkRNTsVx0nWDFvQs9k5sz7o3w4kHCfck0uCzohn1rewyAY 53U37iLVAtSTf/QgIOsBZOIOHEm6zoM4QsYf6GDKsIbSUNIdlJ7e3nPC+/dBrGgBGzKA amxqptj+GHS6YuPJ/tppRnrumpMMeSES4KKyN8Dy/tX2dF10hqICJBbIYs2qgjE6gdvf w7og+Ms0015FiX1uaXRBrXcx5sjQRiYDuAnpon5/NesBrByYCpwxrEUqo2kYt+AW6rhP xpQJywOgUahZkGA0Na0VlEJdg+FmCpeSsISJpY799WH50AUSgClEVY8AD+YtTlUF6pHA J2tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GBgK2hLQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g13-20020a1709065d0d00b008cbb481fc84si395343ejt.20.2023.04.10.03.57.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 03:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GBgK2hLQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59D72385770F for ; Mon, 10 Apr 2023 10:57:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59D72385770F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681124275; bh=FppgRun1m6M32ftK2gKw+pstH7ClD6SkNtBCUDciW/k=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=GBgK2hLQsZWGL6KLuCFApbt0+Py5fTEY1m525wZnms3CvK7jHt6lrl0M99uxfWPMk cco1oLsIrsHx4kD7EKQT4KOzNxEfDdxKPlQ9smVAklvDc/j6yEmewUjJqZWURGWwY8 JHQ7ZKWtRHSNNPDXIu2gtgpAIvC6fLq+cbkLKCyo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 6A2033858C3A for ; Mon, 10 Apr 2023 10:56:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A2033858C3A Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-638bb0b8aacso45924b3a.0 for ; Mon, 10 Apr 2023 03:56:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681124213; x=1683716213; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FppgRun1m6M32ftK2gKw+pstH7ClD6SkNtBCUDciW/k=; b=rEhUNiav7/Cp4HSOuBIQJH2SkRpkFs/31Lu4cVmghMrNNvdUJxjaCI+aH4300nf88Y klvhzn1gyNO9hXgoSaIjYhDtTOTWw1QkN1gxQ7ipH1fDrccDHnnHuXCHLMSJH0A3hzkA DQLACrSgOp7joyOAtMxaBXVOwuJMs74am6pYR6WF2qUQvBeeRh8N0Tk7uuAcTORLYtNO JZo6Wpee6GR8pQumLiiu0ynnakHi459INqGjnaoVT86z26N5WCaOWTvf+0zpDM1uS8SG c3nuYfhgzvBmq8xchmq50lSk7YYWx54xmE/x53pe7Fy34z+8ytmk4hsLqtVD1UE7DXtY Lv3Q== X-Gm-Message-State: AAQBX9eppcWnoSVNvk7mqd78HMnvxyNI4UWxVsOTUCrqUGwvvSaXbfTR uN+TBRJdC3EoB5hIERZNtLIRlIQpccheh5iYOjY/0g== X-Received: by 2002:a17:903:743:b0:1a0:4405:5787 with SMTP id kl3-20020a170903074300b001a044055787mr8316720plb.0.1681124212698; Mon, 10 Apr 2023 03:56:52 -0700 (PDT) Received: from localhost.localdomain ([47.246.101.50]) by smtp.gmail.com with ESMTPSA id jo18-20020a170903055200b001a051eb014bsm7479427plb.219.2023.04.10.03.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 03:56:52 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: shihua@iscas.ac.cn, philipp.tomsich@vrull.eu, kito.cheng@gmail.com, jeffreyalaw@gmail.com, Sinan Lin Subject: [PATCH] RISC-V: add TARGET_ZBKB to the condition of bswapsi2, bswapdi2 and rotr3 patterns Date: Mon, 10 Apr 2023 18:56:40 +0800 Message-Id: <20230410105640.6510-1-mynameisxiaou@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lin Sinan via Gcc-patches From: Lin Sinan Reply-To: Lin Sinan Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762786571299522033?= X-GMAIL-MSGID: =?utf-8?q?1762786571299522033?= From: Sinan Lin tell gcc that zbkb has these two spn to enable some optimizations. e.g. 1) the rrotate_expr could match to rotrm3 during expand; 2) hook up __builtin_bswap64 with `rev8` in zbkb64. --- gcc/config/riscv/bitmanip.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md index 7aa591689ba..3ed9f5d403a 100644 --- a/gcc/config/riscv/bitmanip.md +++ b/gcc/config/riscv/bitmanip.md @@ -297,7 +297,7 @@ [(set (match_operand:GPR 0 "register_operand") (rotatert:GPR (match_operand:GPR 1 "register_operand") (match_operand:QI 2 "arith_operand")))] - "TARGET_ZBB || TARGET_XTHEADBB" + "TARGET_ZBB || TARGET_XTHEADBB || TARGET_ZBKB" { if (TARGET_XTHEADBB && !immediate_operand (operands[2], VOIDmode)) FAIL; @@ -362,12 +362,12 @@ (define_expand "bswapdi2" [(set (match_operand:DI 0 "register_operand") (bswap:DI (match_operand:DI 1 "register_operand")))] - "TARGET_64BIT && (TARGET_ZBB || TARGET_XTHEADBB)") + "TARGET_64BIT && (TARGET_ZBB || TARGET_XTHEADBB || TARGET_ZBKB)") (define_expand "bswapsi2" [(set (match_operand:SI 0 "register_operand") (bswap:SI (match_operand:SI 1 "register_operand")))] - "(!TARGET_64BIT && TARGET_ZBB) || TARGET_XTHEADBB") + "(!TARGET_64BIT && (TARGET_ZBB || TARGET_ZBKB)) || TARGET_XTHEADBB") (define_insn "*bswap2" [(set (match_operand:X 0 "register_operand" "=r")