From patchwork Mon Oct 24 02:20:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 8125 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp214093wru; Sun, 23 Oct 2022 19:21:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Hg43tbAisNVEbJgij5Qn6qJuws/TiXi1ZZbucPUe3PXNNf++hm541kojhXk72s9BF5+ra X-Received: by 2002:a05:6402:350d:b0:45c:f5a2:348e with SMTP id b13-20020a056402350d00b0045cf5a2348emr28534289edd.398.1666578068390; Sun, 23 Oct 2022 19:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666578068; cv=none; d=google.com; s=arc-20160816; b=hv3WVAaWf1JAwRr2jb0fTiX5i9c2ULLf4skUazUFA42szxp5qqbgVFXw0HU/c/A8ay EaWfPFrYortdm+FfLPbVNmpyRd8FEcJZkw53SylogcEtz/yaepNwc9tSfkkt7Kb60Fur HYkJCMQEPlT8T3G8TrjRPw1cqvPfeGlhG/6J1G6y0WwCF/12x1TmAOLyEkj5RWmsNEuJ +8JDxNiIj5SvLblUZeFD/X25R1krVafEFf7cDuxQcTYhpJRJxh1taZVOSc5rLJj2T6Kr BsM3Red8YFSP9MQbD/f5p46qxD2TvBKOx9SpdHJt/8U1FZyu3WBYLoqk7hTz+vH6fZ2B dS6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:to :from:dmarc-filter:delivered-to; bh=Uzf1i7cFODWbdHuAwztMJ/WmWRgx43/TOLhpm+xY4ng=; b=bfWIfk6yGUfTGrKmGf+aKbLtWWVea/DgBy69ujOv0Iunew9VjCRwM5vvEPT36xLrEw umZHEB4wfCklXmTEkc8boEfZVoz0paZQKctxxhJcrAISCVb110VqgEzWgck2fcNj+EWE JDuVR/MBUtfCHtX1YxRIv/DHTNo2ZgcyRmUOENX1fEnqC64njdUHq5rv/Ve18tfIK9o3 FGxSeEACPBjNl4OQaTaJtdE8YKQnW9HwWJfmmj4QBmmHucWtqdBxEJh+D7jsHw2KoWFi vFJY51dF1PjEK7wNS3t1HkAI1mHV9wEFyCPQNzx8mtcQQvfuLWka5xaf91bwlS1HiiLO 5kOQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id jg16-20020a170907971000b00782686da1d1si25500228ejc.761.2022.10.23.19.21.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Oct 2022 19:21:08 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43F0B3856183 for ; Mon, 24 Oct 2022 02:21:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by sourceware.org (Postfix) with ESMTPS id 2C5C5385840A for ; Mon, 24 Oct 2022 02:20:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2C5C5385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp90t1666578030t72eg3d5 Received: from server1.localdomain ( [42.247.22.65]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 24 Oct 2022 10:20:29 +0800 (CST) X-QQ-SSF: 01400000000000D0K000000A0000000 X-QQ-FEAT: xo0edGM1fUheS0PWTO6ZTSNECy56p6iUXE1gev1uLihwqzuGMRWh7shK5cmlV p6AfXQhZBawzPCJVrMdQ2R5EU+Gzu2sm0sy6+e5PxJ+BSlv7AVYKx8IHBlIJ1dmiKZbG9UT pIYR7Xk4kC2y7D872+3v7prAbTrv8hCGjhHncsDaGwFHH0/1hj2Kt7B6mJk+FW4gC8xxVf1 ERem/nG6rgILq2Efsx4SVSYjOvgqUn/DTcxImVsd8VDJ/nyqsF60hdnmwqkZza0QvxoGAtS lxsMJ9Z7VGQk3IutnVRaSIwQ47KDEAgPtclCBjUzwiqVgfzVdz9Z5HnioTO1pigb/vn5XtP W0a48faV0zFtoquifcWWOcWUfsjv5aglK7ce4E35L1AR/FfGOpzmEHhrkwahE31kyj8abON cGZx/aaOtFk= X-QQ-GoodBg: 2 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Replace CONSTEXPR with constexpr Date: Mon, 24 Oct 2022 10:20:28 +0800 Message-Id: <20221024022028.197505-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, TXREP, T_SPF_HELO_TEMPERROR 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: , Cc: kito.cheng@gmail.com, Ju-Zhe Zhong 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?1747533764212634626?= X-GMAIL-MSGID: =?utf-8?q?1747533764212634626?= From: Ju-Zhe Zhong Move away from the pre-C++11 compatibility macro CONSTEXPR. This patch is inspired by aarch64: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603974.html. gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc: Replace CONSTEXPR with constexpr throughout. * config/riscv/riscv-vector-builtins-shapes.cc (SHAPE): Likewise. * config/riscv/riscv-vector-builtins.cc (struct registered_function_hasher): Likewise. * config/riscv/riscv-vector-builtins.h (struct rvv_arg_type_info): Likewise. --- gcc/config/riscv/riscv-vector-builtins-bases.cc | 4 ++-- gcc/config/riscv/riscv-vector-builtins-shapes.cc | 2 +- gcc/config/riscv/riscv-vector-builtins.cc | 14 +++++++------- gcc/config/riscv/riscv-vector-builtins.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index 231b63a610d..713a7566e29 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -84,8 +84,8 @@ public: } }; -static CONSTEXPR const vsetvl vsetvl_obj; -static CONSTEXPR const vsetvl vsetvlmax_obj; +static constexpr const vsetvl vsetvl_obj; +static constexpr const vsetvl vsetvlmax_obj; namespace bases { const function_base *const vsetvl = &vsetvl_obj; const function_base *const vsetvlmax = &vsetvlmax_obj; diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc index 24fc1c02341..14c59690c06 100644 --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc @@ -71,7 +71,7 @@ build_all (function_builder &b, const function_group_info &group) /* Declare the function shape NAME, pointing it to an instance of class _def. */ #define SHAPE(DEF, VAR) \ - static CONSTEXPR const DEF##_def VAR##_obj; \ + static constexpr const DEF##_def VAR##_obj; \ namespace shapes { const function_shape *const VAR = &VAR##_obj; } /* Base class for for build. */ diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index dc410788c99..caeb97211f9 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -88,7 +88,7 @@ struct registered_function_hasher : nofree_ptr_hash }; /* Static information about each RVV type. */ -static CONSTEXPR const vector_type_info vector_types[] = { +static constexpr const vector_type_info vector_types[] = { #define DEF_RVV_TYPE(NAME, NCHARS, ABI_NAME, ARGS...) \ {#NAME, #ABI_NAME, "u" #NCHARS #ABI_NAME}, #include "riscv-vector-builtins.def" @@ -123,23 +123,23 @@ static const rvv_type_info i_ops[] = { #include "riscv-vector-builtins-types.def" {NUM_VECTOR_TYPES, 0}}; -static CONSTEXPR const rvv_arg_type_info rvv_arg_type_info_end +static constexpr const rvv_arg_type_info rvv_arg_type_info_end = rvv_arg_type_info (NUM_BASE_TYPES); /* A list of args for size_t func (void) function. */ -static CONSTEXPR const rvv_arg_type_info void_args[] +static constexpr const rvv_arg_type_info void_args[] = {rvv_arg_type_info (RVV_BASE_void), rvv_arg_type_info_end}; /* A list of args for size_t func (size_t) function. */ -static CONSTEXPR const rvv_arg_type_info size_args[] +static constexpr const rvv_arg_type_info size_args[] = {rvv_arg_type_info (RVV_BASE_size), rvv_arg_type_info_end}; /* A list of none preds that will be registered for intrinsic functions. */ -static CONSTEXPR const predication_type_index none_preds[] +static constexpr const predication_type_index none_preds[] = {PRED_TYPE_none, NUM_PRED_TYPES}; /* A static operand information for size_t func (void) function registration. */ -static CONSTEXPR const rvv_op_info i_none_size_void_ops +static constexpr const rvv_op_info i_none_size_void_ops = {i_ops, /* Types */ OP_TYPE_none, /* Suffix */ rvv_arg_type_info (RVV_BASE_size), /* Return type */ @@ -147,7 +147,7 @@ static CONSTEXPR const rvv_op_info i_none_size_void_ops /* A static operand information for size_t func (size_t) function registration. */ -static CONSTEXPR const rvv_op_info i_none_size_size_ops +static constexpr const rvv_op_info i_none_size_size_ops = {i_ops, /* Types */ OP_TYPE_none, /* Suffix */ rvv_arg_type_info (RVV_BASE_size), /* Return type */ diff --git a/gcc/config/riscv/riscv-vector-builtins.h b/gcc/config/riscv/riscv-vector-builtins.h index 425da12326c..e5636e23a7c 100644 --- a/gcc/config/riscv/riscv-vector-builtins.h +++ b/gcc/config/riscv/riscv-vector-builtins.h @@ -171,7 +171,7 @@ struct rvv_builtin_suffixes /* RVV Builtin argument information. */ struct rvv_arg_type_info { - CONSTEXPR rvv_arg_type_info (rvv_base_type base_type_in) + constexpr rvv_arg_type_info (rvv_base_type base_type_in) : base_type (base_type_in) {} enum rvv_base_type base_type;