public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: juzhe.zhong@rivai.ai
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] RISC-V: Replace CONSTEXPR with constexpr
Date: Mon, 24 Oct 2022 10:25:34 +0800	[thread overview]
Message-ID: <CA+yXCZBOJOzCL0d9J8Y8q7UtHVtUU9G4eo+y=JCky-ck_2BjCw@mail.gmail.com> (raw)
In-Reply-To: <20221024022028.197505-1-juzhe.zhong@rivai.ai>

Committed, thanks!

On Mon, Oct 24, 2022 at 10:21 AM <juzhe.zhong@rivai.ai> wrote:
>
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> 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<false> vsetvl_obj;
> -static CONSTEXPR const vsetvl<true> vsetvlmax_obj;
> +static constexpr const vsetvl<false> vsetvl_obj;
> +static constexpr const vsetvl<true> 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 <NAME>_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<registered_function>
>  };
>
>  /* 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;
> --
> 2.36.1
>

      reply	other threads:[~2022-10-24  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24  2:20 juzhe.zhong
2022-10-24  2:25 ` Kito Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+yXCZBOJOzCL0d9J8Y8q7UtHVtUU9G4eo+y=JCky-ck_2BjCw@mail.gmail.com' \
    --to=kito.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).