From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688018462; x=1719554462; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=K4Lee7VUYYD97WfiCdxs1rZTFglIHseTzaYep6lM6lQ=; b=FzmwSiU0q8bd2DzydD+/qPmTxrAlzXZWV1qhye8fh8cGp3U9ADREyYXA v7myVvu9OYW0102z14j3VywFYIxdEWJQJ7D9pyQLVYUXbQET5y4Watjhi 9LqnhpfahOSQaDtEabwjJx/6DYaWd3bLeI+jAwQtU3/yNfYpR/b5QfRQH 4YkN3We8yh+1jsJannbtubxUSUqVKM4iz/zKdKjap1Qf3pPdZ3ncetfXJ oslNAZ0ng34ikX96sW7EbwPPVia4uCAKiLWlXFDmjjWs+ZhxAMnGoebcR 2CRuB7vqABZjkSK5mXRvwVRrpXfZ8ryTJYk5Iy5uVhHbDz6qjgzA1NBXW w==; 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) From: pan2.li@intel.com 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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. --- 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 -- 2.34.1