From patchwork Fri Dec 29 04:05:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: joshua X-Patchwork-Id: 183846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2371305dyb; Thu, 28 Dec 2023 20:06:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2G+JlPom12x97J7EkWRToAQ6+4aVunPIumnmAhQ+mDCexcTdq7b/fJGrA8q62jPGZ4Rhj X-Received: by 2002:a05:620a:2448:b0:77f:2f1b:ad3b with SMTP id h8-20020a05620a244800b0077f2f1bad3bmr16076434qkn.146.1703822769502; Thu, 28 Dec 2023 20:06:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703822769; cv=pass; d=google.com; s=arc-20160816; b=J7pseEGtLX8YX+wbjcuUuSZBZwrIJv6jb37WQJKMtH8LG02UqhrTFVYgybCtopYbAU UqTjxTP+hZiVCDKo9CbIM+oF53mfSfFzOWo5/WwxRBk1bJsU8TcMY3j5XbmQ0Bis6k3e Z18eRKCTyWeBmvIatC0F9EjpCFpgw16DtrK04nIoblSLkL5nHTYy3lXYVIBFJsUV05GG nUH/JQFy6CFvns5rauoE+cZrwbPz51ci4Xvlhpe4Fu4Ap1gxEiaAhpIoW8YDB0xSXVx+ lfzXH+m26mw+RQgzpDgmoGJXdpJpAmKIJKcjJ2jaVSby8Uj+sk0sl+4gzid4ztUP60Zm e8xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to; bh=3ZmBjIsu+7WXdvwunw5gAb7he91itxQgczltejMCsX8=; fh=TRVAIDsvPpet1cO/KeaYdiXE7OYydCC57sZbOkt55RI=; b=KpqRGqglrE/vryCs57463AWoZsSbzjl523poQU02g4OaBNU/pU80ntuzPCCAlwqDTE 3NizQ/sJMiRWVXMvC+TpI6VqiysB6td+pQbPKFeH1D1eKjyVXIcB+9OAPKeNdbS8bzIj klWe5NK5ifDWwGccnQ+KkjmZXUGUKaafetlKOGouQZhjxV4BUXgjxfl8UYSsRkW3wVji ib+Gb1UaiEZyrKI7unrMNfQ+V6MqEeEkZdMYBNcx3z5x/qaMoBMBk79cQrxR38PB7tTl 3/mGCrI4x6CvfSYbi/48nRr/DQg4c7wJL6kokKFxIhlt7/Oxv7oyr5t4tmHahv2TLKnn 2pdw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d23-20020a0cb2d7000000b0067f61d6a5c9si4013232qvf.440.2023.12.28.20.06.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 20:06:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39D7F3858C31 for ; Fri, 29 Dec 2023 04:06:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by sourceware.org (Postfix) with ESMTPS id C3E293858D28 for ; Fri, 29 Dec 2023 04:05:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3E293858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C3E293858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=115.124.30.97 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703822735; cv=none; b=dQXT0jis0Xm2hRHqIa4Rk/Hsmw2ppmBfvBq35SgY6o3fLtzz9UkprbNOHZPU37UA7L4Lm+qzKuVqvd0UzCaU+tbK++ZPDtZ8Ui/Oz1r/FLZfg3VASdbR1WnMStSgtPhiza27TQTDkKZZlFJYq12AWPGhm6i5K06h7SYUWhiYMeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703822735; c=relaxed/simple; bh=cfGmHa3DRbxPlZAG6Uor0ZReUMVY8RImYzqtXyrOFPY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=ZAleFPF17vcKf8LctWeSvOUegfrYyPDEqD+cpRVnud0eVmV8cad7DuNiXLqQVSOPqdlgTsFY9NqnN7ZoBWCCIV7DyEcZNmZ/40zRDFLiuse7G3y21Ksy4AeOFaQQ0y9TtEqIISl4oRGs22Hw4NGNxK9/k/JroOiUb9gu54e0cyk= ARC-Authentication-Results: i=1; server2.sourceware.org X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R641e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046056; MF=cooper.joshua@linux.alibaba.com; NM=1; PH=DS; RN=11; SR=0; TI=SMTPD_---0VzQJplF_1703822726; Received: from localhost.localdomain(mailfrom:cooper.joshua@linux.alibaba.com fp:SMTPD_---0VzQJplF_1703822726) by smtp.aliyun-inc.com; Fri, 29 Dec 2023 12:05:28 +0800 From: "Jun Sha (Joshua)" To: gcc-patches@gcc.gnu.org Cc: jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, philipp.tomsich@vrull.eu, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu, juzhe.zhong@rivai.ai, "Jun Sha (Joshua)" , Jin Ma , Xianmiao Qu Subject: [PATCH v4] RISC-V: Refactor riscv-vector-builtins-bases.cc Date: Fri, 29 Dec 2023 12:05:17 +0800 Message-Id: <20231229040517.1100-1-cooper.joshua@linux.alibaba.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20231229040310.1047-1-cooper.joshua@linux.alibaba.com> References: <20231229040310.1047-1-cooper.joshua@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-20.3 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786587664168322681 X-GMAIL-MSGID: 1786587664168322681 This patch moves the definition of the enums lst_type and frm_op_type into riscv-vector-builtins-bases.h and removes the static visibility of fold_fault_load(), so these can be used in other compile units. gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (enum lst_type): (enum frm_op_type): move to riscv-vector-builtins-bases.h * config/riscv/riscv-vector-builtins-bases.h (GCC_RISCV_VECTOR_BUILTINS_BASES_H): Add header files. (enum lst_type): move from (enum frm_op_type): riscv-vector-builtins-bases.cc (fold_fault_load): riscv-vector-builtins-bases.cc Co-authored-by: Jin Ma Co-authored-by: Xianmiao Qu Co-authored-by: Christoph Müllner --- .../riscv/riscv-vector-builtins-bases.cc | 18 +----------------- .../riscv/riscv-vector-builtins-bases.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index d70468542ee..c51affde353 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -48,24 +48,8 @@ using namespace riscv_vector; namespace riscv_vector { -/* Enumerates types of loads/stores operations. - It's only used in here so we don't define it - in riscv-vector-builtins-bases.h. */ -enum lst_type -{ - LST_UNIT_STRIDE, - LST_STRIDED, - LST_INDEXED, -}; - -enum frm_op_type -{ - NO_FRM, - HAS_FRM, -}; - /* Helper function to fold vleff and vlsegff. */ -static gimple * +gimple * fold_fault_load (gimple_folder &f) { /* fold fault_load (const *base, size_t *new_vl, size_t vl) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.h b/gcc/config/riscv/riscv-vector-builtins-bases.h index 131041ea66f..42d0cd17dc1 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.h +++ b/gcc/config/riscv/riscv-vector-builtins-bases.h @@ -21,8 +21,27 @@ #ifndef GCC_RISCV_VECTOR_BUILTINS_BASES_H #define GCC_RISCV_VECTOR_BUILTINS_BASES_H +#include "gimple.h" +#include "riscv-vector-builtins.h" + namespace riscv_vector { +/* Enumerates types of loads/stores operations. */ +enum lst_type +{ + LST_UNIT_STRIDE, + LST_STRIDED, + LST_INDEXED, +}; + +enum frm_op_type +{ + NO_FRM, + HAS_FRM, +}; + +extern gimple *fold_fault_load (gimple_folder &f); + namespace bases { extern const function_base *const vsetvl; extern const function_base *const vsetvlmax;