> #ifndef DEF_RVV_FUNCTION > -#define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO) > +#define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO, AVAIL)
#define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO, ...) And add a comment to mention 5th argument is optional for AVAIL. > #endif > > /* Internal helper functions for gimple fold use. */ > -DEF_RVV_FUNCTION (read_vl, read_vl, none_preds, p_none_void_ops) > -DEF_RVV_FUNCTION (vlenb, vlenb, none_preds, ul_none_void_ops) > +DEF_RVV_FUNCTION (read_vl, read_vl, none_preds, p_none_void_ops, always) > +DEF_RVV_FUNCTION (vlenb, vlenb, none_preds, ul_none_void_ops, always) Then you don't need to add `always` if it's `always`. > diff --git a/gcc/config/riscv/riscv-vector-builtins.cc > b/gcc/config/riscv/riscv-vector-builtins.cc > index 6330a3a41c3..dac638b6bcc 100644 > --- a/gcc/config/riscv/riscv-vector-builtins.cc > +++ b/gcc/config/riscv/riscv-vector-builtins.cc > @@ -51,6 +51,7 @@ > #include "riscv-vector-builtins.h" > #include "riscv-vector-builtins-shapes.h" > #include "riscv-vector-builtins-bases.h" > +#include "riscv-vector-builtins-avail.h" > > using namespace riscv_vector; > > @@ -2684,8 +2685,9 @@ static CONSTEXPR const function_type_info > function_types[] = { > > /* A list of all RVV intrinsic functions. */ > static function_group_info function_groups[] = { > -#define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO) > \ > - {#NAME, &bases::NAME, &shapes::SHAPE, PREDS, OPS_INFO}, > +#define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO, AVAIL) > \ #define DEF_RVV_FUNCTION(NAME, SHAPE, PREDS, OPS_INFO, ...) __VA_ARGS__ {#NAME, &bases::NAME, &shapes::SHAPE, PREDS, OPS_INFO,\ __VA_ARGS__}, > + {#NAME, &bases::NAME, &shapes::SHAPE, PREDS, OPS_INFO,\ > + riscv_vector_avail_ ## AVAIL}, > #include "riscv-vector-builtins-functions.def" > }; > > diff --git a/gcc/config/riscv/riscv-vector-builtins.h > b/gcc/config/riscv/riscv-vector-builtins.h > index cd8ccab1724..74d50c2f849 100644 > --- a/gcc/config/riscv/riscv-vector-builtins.h > +++ b/gcc/config/riscv/riscv-vector-builtins.h > @@ -232,6 +232,8 @@ struct function_group_info > on the index value. */ > const predication_type_index *preds; > const rvv_op_info ops_infos; > + /* Whether the function is available. */ > + unsigned int (*avail) (void); Then write a constexpr constructor like this commit: https://github.com/gcc-mirror/gcc/commit/9e12010b5e724277ea44c300630802f464407d8d#diff-d6f7db0db31bfb339b01bec450f1b905381eb4730cc5ab2b2794971e34647d64R46-R49 > }; > > class GTY ((user)) function_instance > -- > 2.17.1 >