From patchwork Thu Jun 29 06:00:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 114166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9422237vqr; Wed, 28 Jun 2023 23:01:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hZCiONO4MT7ylkMlpTbVmkLMMizagottnOk/WhRkBjc/7Q/eYiW5lKEaPExHHIKJla0po X-Received: by 2002:a17:906:ee82:b0:988:f307:aea3 with SMTP id wt2-20020a170906ee8200b00988f307aea3mr23625510ejb.9.1688018512085; Wed, 28 Jun 2023 23:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688018512; cv=none; d=google.com; s=arc-20160816; b=Z3B+NzcWjjNsy+WRzL9hle3/Y+UB7z+qd9Km1qzAggzTLBjiGPKnAjwDFHMRlPvgEw kRZqVpE0gFIAwv7u8MtApwUxm05jtkxxQGetbuqdpavTNpbmKPjy6oQHrZRyfX2Eqe4+ O8bImMVfu01qlc++43VrfgQAgLHpAWNbJsr79tHYrvxt9keWxj0dseeOSuuOXhMa4b1G UMcvMBOeI6k4U3tAEob1bI1g2DxAXOpv1JjJ0LpJfqP+/rTGeDP9R/J83AvptVxwdL24 682akz0CXRKB1tlQPqYhlEN9c7kaD/so2Sy9jbNrjCBebhhaWYOBrxR6edoq+YKLQjtd wBug== 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=Xnqdkn74ViWTOzAxb+TtPUGWRA/q5F7eimnte6M96Zc=; fh=GasQrrWToGs9W2cdWsEVz8fedwI3qZs4k2uUX5t1Yho=; b=EmNwlo8UUZNHPDDxCqi/LEGrroNwWs1SOK0wx31feg4MIZjRgaTwiEMrQpZe/o6wL/ 6jZMjNlQkTWpn2spfb6N9sfeb9NiTE2C8qNGpKDf1usPX7bP9RJsmrMEpl2gva0RKvLo PRF7siCkWzxmyUfRqm5suSQcy7AAG+GuwouZf5P+naCh1lwOQoR9QaRPMsB8jgCeDNIQ dI6baTiMY4QQlSSWZaWxuj40f9P2pb6bmo+sD8KmeLW3WIKIOxcAbwktkYoHYMGqSqSX WB9Caj08kkZrvsDs28xvVYvCUfV0h9a/kDEQ8UztRMOxDys1+GcLYzsysWc2cyfzcMwJ 3Dkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YfyDeZOJ; 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 lz14-20020a170906fb0e00b0099233cac125si2601837ejb.915.2023.06.28.23.01.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 23:01:51 -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=YfyDeZOJ; 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 B54AA385841A for ; Thu, 29 Jun 2023 06:01:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B54AA385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688018509; bh=Xnqdkn74ViWTOzAxb+TtPUGWRA/q5F7eimnte6M96Zc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=YfyDeZOJ7eICuXqakQSWJhSdsXqrGELQpiBWJeLrb+e607hfOjHVoKiOCylsYUo81 /fOWP12qf0FL/CjYgIR7sAGhQS8zSB4zv6PIttMlrIh2FAj3AG3ac2g3qhhe1wg8jU FgzgDFQKR1y1whMoStWvuWABK0bb1cQupLw/ihf0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by sourceware.org (Postfix) with ESMTPS id 9A7133858D35 for ; Thu, 29 Jun 2023 06:01:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A7133858D35 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="362070657" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="362070657" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 23:01:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="720443576" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="720443576" Received: from shvmail02.sh.intel.com ([10.239.244.9]) by fmsmga007.fm.intel.com with ESMTP; 28 Jun 2023 23:00:59 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail02.sh.intel.com (Postfix) with ESMTP id B682110083D7; Thu, 29 Jun 2023 14:00:58 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@sifive.com, pan2.li@intel.com, yanzhang.wang@intel.com, jeffreyalaw@gmail.com Subject: [PATCH v1] RISC-V: Refactor vxrm_mode attr for type attr equal Date: Thu, 29 Jun 2023 14:00:54 +0800 Message-Id: <20230629060054.617743-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: Pan Li via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: pan2.li@intel.com 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?1770015698499290668?= X-GMAIL-MSGID: =?utf-8?q?1770015698499290668?= From: Pan Li This patch would like to refactor the vxrm_mode attr for duplicated eq_attr condition. The common condition of attr is extraced to one place instead of many places. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/vector.md: Refactor the common condition. Signed-off-by: Pan Li Signed-off-by: Pan Li --- gcc/config/riscv/vector.md | 39 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index 406f96439ec..ebb7648b4df 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -445,22 +445,29 @@ (define_attr "avl_type" "" ;; Defines rounding mode of an fixed-point operation. (define_attr "vxrm_mode" "rnu,rne,rdn,rod,none" - (cond [(and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip") - (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RNU")) - (const_string "rnu") - - (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip") - (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RNE")) - (const_string "rne") - - (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip") - (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RDN")) - (const_string "rdn") - - (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip") - (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_ROD")) - (const_string "rod")] - (const_string "none"))) + (cond + [ + (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip") + (cond + [ + (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNU") + (const_string "rnu") + + (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNE") + (const_string "rne") + + (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RDN") + (const_string "rdn") + + (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_ROD") + (const_string "rod") + ] + (const_string "none") + ) + ] + (const_string "none") + ) +) ;; ----------------------------------------------------------------- ;; ---- Miscellaneous Operations