summaryrefslogtreecommitdiff
path: root/0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch
diff options
context:
space:
mode:
Diffstat (limited to '0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch')
-rw-r--r--0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch394
1 files changed, 394 insertions, 0 deletions
diff --git a/0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch b/0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch
new file mode 100644
index 0000000..31f8b7a
--- /dev/null
+++ b/0122-Backport-SME-aarch64-Make-more-use-of-aarch64_featur.patch
@@ -0,0 +1,394 @@
+From bdb91009cf250fb22c21ae7f5072263492f2b08c Mon Sep 17 00:00:00 2001
+From: Richard Sandiford <richard.sandiford@arm.com>
+Date: Thu, 29 Sep 2022 11:32:56 +0100
+Subject: [PATCH 023/157] [Backport][SME] aarch64: Make more use of
+ aarch64_feature_flags
+
+Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=fed55a60e5b230bc159617f26e33611073c672fd
+
+A previous patch added a aarch64_feature_flags typedef, to abstract
+the representation of the feature flags. This patch makes existing
+code use the typedef too. Hope I've caught them all!
+
+gcc/
+ * common/config/aarch64/aarch64-common.cc: Use aarch64_feature_flags
+ for feature flags throughout.
+ * config/aarch64/aarch64-protos.h: Likewise.
+ * config/aarch64/aarch64-sve-builtins.h: Likewise.
+ * config/aarch64/aarch64-sve-builtins.cc: Likewise.
+ * config/aarch64/aarch64.cc: Likewise.
+ * config/aarch64/aarch64.opt: Likewise.
+ * config/aarch64/driver-aarch64.cc: Likewise.
+---
+ gcc/common/config/aarch64/aarch64-common.cc | 19 +++++++-------
+ gcc/config/aarch64/aarch64-protos.h | 5 ++--
+ gcc/config/aarch64/aarch64-sve-builtins.cc | 29 ++++++++++++---------
+ gcc/config/aarch64/aarch64-sve-builtins.h | 9 ++++---
+ gcc/config/aarch64/aarch64.cc | 29 +++++++++++----------
+ gcc/config/aarch64/aarch64.opt | 2 +-
+ gcc/config/aarch64/driver-aarch64.cc | 10 +++----
+ 7 files changed, 56 insertions(+), 47 deletions(-)
+
+diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc
+index ac3486d71..3efa57b26 100644
+--- a/gcc/common/config/aarch64/aarch64-common.cc
++++ b/gcc/common/config/aarch64/aarch64-common.cc
+@@ -204,9 +204,9 @@ aarch64_handle_option (struct gcc_options *opts,
+ struct aarch64_option_extension
+ {
+ const char *name;
+- uint64_t flag_canonical;
+- uint64_t flags_on;
+- uint64_t flags_off;
++ aarch64_feature_flags flag_canonical;
++ aarch64_feature_flags flags_on;
++ aarch64_feature_flags flags_off;
+ };
+
+ /* ISA extensions in AArch64. */
+@@ -225,14 +225,14 @@ struct processor_name_to_arch
+ {
+ const char *processor_name;
+ aarch64_arch arch;
+- uint64_t flags;
++ aarch64_feature_flags flags;
+ };
+
+ struct arch_to_arch_name
+ {
+ aarch64_arch arch;
+ const char *arch_name;
+- uint64_t flags;
++ aarch64_feature_flags flags;
+ };
+
+ /* Map processor names to the architecture revision they implement and
+@@ -262,7 +262,7 @@ static constexpr arch_to_arch_name all_architectures[] =
+ a copy of the string is created and stored to INVALID_EXTENSION. */
+
+ enum aarch64_parse_opt_result
+-aarch64_parse_extension (const char *str, uint64_t *isa_flags,
++aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags,
+ std::string *invalid_extension)
+ {
+ /* The extension string is parsed left to right. */
+@@ -342,8 +342,9 @@ aarch64_get_all_extension_candidates (auto_vec<const char *> *candidates)
+ that all the "+" flags come before the "+no" flags. */
+
+ std::string
+-aarch64_get_extension_string_for_isa_flags (uint64_t isa_flags,
+- uint64_t default_arch_flags)
++aarch64_get_extension_string_for_isa_flags
++ (aarch64_feature_flags isa_flags,
++ aarch64_feature_flags default_arch_flags)
+ {
+ std::string outstr = "";
+
+@@ -451,7 +452,7 @@ aarch64_rewrite_selected_cpu (const char *name)
+ || a_to_an->arch == aarch64_no_arch)
+ fatal_error (input_location, "unknown value %qs for %<-mcpu%>", name);
+
+- uint64_t extensions = p_to_a->flags;
++ aarch64_feature_flags extensions = p_to_a->flags;
+ aarch64_parse_extension (extension_str.c_str (), &extensions, NULL);
+
+ std::string outstr = a_to_an->arch_name
+diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
+index e60ce3c36..ef84df731 100644
+--- a/gcc/config/aarch64/aarch64-protos.h
++++ b/gcc/config/aarch64/aarch64-protos.h
+@@ -1037,10 +1037,11 @@ bool aarch64_handle_option (struct gcc_options *, struct gcc_options *,
+ const struct cl_decoded_option *, location_t);
+ const char *aarch64_rewrite_selected_cpu (const char *name);
+ enum aarch64_parse_opt_result aarch64_parse_extension (const char *,
+- uint64_t *,
++ aarch64_feature_flags *,
+ std::string *);
+ void aarch64_get_all_extension_candidates (auto_vec<const char *> *candidates);
+-std::string aarch64_get_extension_string_for_isa_flags (uint64_t, uint64_t);
++std::string aarch64_get_extension_string_for_isa_flags (aarch64_feature_flags,
++ aarch64_feature_flags);
+
+ rtl_opt_pass *make_pass_fma_steering (gcc::context *);
+ rtl_opt_pass *make_pass_track_speculation (gcc::context *);
+diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
+index c06e99339..b927a886e 100644
+--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
++++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
+@@ -82,7 +82,7 @@ public:
+
+ /* The architecture extensions that the function requires, as a set of
+ AARCH64_FL_* flags. */
+- uint64_t required_extensions;
++ aarch64_feature_flags required_extensions;
+
+ /* True if the decl represents an overloaded function that needs to be
+ resolved by function_resolver. */
+@@ -694,13 +694,16 @@ check_required_registers (location_t location, tree fndecl)
+ Report an error against LOCATION if not. */
+ static bool
+ check_required_extensions (location_t location, tree fndecl,
+- uint64_t required_extensions)
++ aarch64_feature_flags required_extensions)
+ {
+- uint64_t missing_extensions = required_extensions & ~aarch64_isa_flags;
++ auto missing_extensions = required_extensions & ~aarch64_isa_flags;
+ if (missing_extensions == 0)
+ return check_required_registers (location, fndecl);
+
+- static const struct { uint64_t flag; const char *name; } extensions[] = {
++ static const struct {
++ aarch64_feature_flags flag;
++ const char *name;
++ } extensions[] = {
+ #define AARCH64_OPT_EXTENSION(EXT_NAME, IDENT, C, D, E, F) \
+ { AARCH64_FL_##IDENT, EXT_NAME },
+ #include "aarch64-option-extensions.def"
+@@ -992,7 +995,7 @@ function_builder::get_attributes (const function_instance &instance)
+ registered_function &
+ function_builder::add_function (const function_instance &instance,
+ const char *name, tree fntype, tree attrs,
+- uint64_t required_extensions,
++ aarch64_feature_flags required_extensions,
+ bool overloaded_p,
+ bool placeholder_p)
+ {
+@@ -1034,11 +1037,12 @@ function_builder::add_function (const function_instance &instance,
+ one-to-one mapping between "short" and "full" names, and if standard
+ overload resolution therefore isn't necessary. */
+ void
+-function_builder::add_unique_function (const function_instance &instance,
+- tree return_type,
+- vec<tree> &argument_types,
+- uint64_t required_extensions,
+- bool force_direct_overloads)
++function_builder::
++add_unique_function (const function_instance &instance,
++ tree return_type,
++ vec<tree> &argument_types,
++ aarch64_feature_flags required_extensions,
++ bool force_direct_overloads)
+ {
+ /* Add the function under its full (unique) name. */
+ char *name = get_name (instance, false);
+@@ -1081,8 +1085,9 @@ function_builder::add_unique_function (const function_instance &instance,
+ features are available as part of resolving the function to the
+ relevant unique function. */
+ void
+-function_builder::add_overloaded_function (const function_instance &instance,
+- uint64_t required_extensions)
++function_builder::
++add_overloaded_function (const function_instance &instance,
++ aarch64_feature_flags required_extensions)
+ {
+ char *name = get_name (instance, true);
+ if (registered_function **map_value = m_overload_names.get (name))
+diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h
+index 24594d584..63d1db776 100644
+--- a/gcc/config/aarch64/aarch64-sve-builtins.h
++++ b/gcc/config/aarch64/aarch64-sve-builtins.h
+@@ -263,7 +263,7 @@ struct function_group_info
+
+ /* The architecture extensions that the functions require, as a set of
+ AARCH64_FL_* flags. */
+- uint64_t required_extensions;
++ aarch64_feature_flags required_extensions;
+ };
+
+ /* Describes a single fully-resolved function (i.e. one that has a
+@@ -321,8 +321,9 @@ public:
+ ~function_builder ();
+
+ void add_unique_function (const function_instance &, tree,
+- vec<tree> &, uint64_t, bool);
+- void add_overloaded_function (const function_instance &, uint64_t);
++ vec<tree> &, aarch64_feature_flags, bool);
++ void add_overloaded_function (const function_instance &,
++ aarch64_feature_flags);
+ void add_overloaded_functions (const function_group_info &,
+ mode_suffix_index);
+
+@@ -338,7 +339,7 @@ private:
+
+ registered_function &add_function (const function_instance &,
+ const char *, tree, tree,
+- uint64_t, bool, bool);
++ aarch64_feature_flags, bool, bool);
+
+ /* The function type to use for functions that are resolved by
+ function_resolver. */
+diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
+index 71db7ace1..8cb820767 100644
+--- a/gcc/config/aarch64/aarch64.cc
++++ b/gcc/config/aarch64/aarch64.cc
+@@ -2929,7 +2929,7 @@ struct processor
+ aarch64_processor ident;
+ aarch64_processor sched_core;
+ aarch64_arch arch;
+- uint64_t flags;
++ aarch64_feature_flags flags;
+ const tune_params *tune;
+ };
+
+@@ -17428,7 +17428,8 @@ static void initialize_aarch64_code_model (struct gcc_options *);
+
+ static enum aarch64_parse_opt_result
+ aarch64_parse_arch (const char *to_parse, const struct processor **res,
+- uint64_t *isa_flags, std::string *invalid_extension)
++ aarch64_feature_flags *isa_flags,
++ std::string *invalid_extension)
+ {
+ const char *ext;
+ const struct processor *arch;
+@@ -17451,7 +17452,7 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res,
+ if (strlen (arch->name) == len
+ && strncmp (arch->name, to_parse, len) == 0)
+ {
+- uint64_t isa_temp = arch->flags;
++ auto isa_temp = arch->flags;
+
+ if (ext != NULL)
+ {
+@@ -17483,7 +17484,8 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res,
+
+ static enum aarch64_parse_opt_result
+ aarch64_parse_cpu (const char *to_parse, const struct processor **res,
+- uint64_t *isa_flags, std::string *invalid_extension)
++ aarch64_feature_flags *isa_flags,
++ std::string *invalid_extension)
+ {
+ const char *ext;
+ const struct processor *cpu;
+@@ -17505,8 +17507,7 @@ aarch64_parse_cpu (const char *to_parse, const struct processor **res,
+ {
+ if (strlen (cpu->name) == len && strncmp (cpu->name, to_parse, len) == 0)
+ {
+- uint64_t isa_temp = cpu->flags;
+-
++ auto isa_temp = cpu->flags;
+
+ if (ext != NULL)
+ {
+@@ -18137,7 +18138,7 @@ aarch64_print_hint_for_extensions (const std::string &str)
+
+ static bool
+ aarch64_validate_mcpu (const char *str, const struct processor **res,
+- uint64_t *isa_flags)
++ aarch64_feature_flags *isa_flags)
+ {
+ std::string invalid_extension;
+ enum aarch64_parse_opt_result parse_res
+@@ -18351,7 +18352,7 @@ aarch64_validate_mbranch_protection (const char *const_str)
+
+ static bool
+ aarch64_validate_march (const char *str, const struct processor **res,
+- uint64_t *isa_flags)
++ aarch64_feature_flags *isa_flags)
+ {
+ std::string invalid_extension;
+ enum aarch64_parse_opt_result parse_res
+@@ -18441,8 +18442,8 @@ aarch64_convert_sve_vector_bits (aarch64_sve_vector_bits_enum value)
+ static void
+ aarch64_override_options (void)
+ {
+- uint64_t cpu_isa = 0;
+- uint64_t arch_isa = 0;
++ aarch64_feature_flags cpu_isa = 0;
++ aarch64_feature_flags arch_isa = 0;
+ aarch64_isa_flags = 0;
+
+ const struct processor *cpu = NULL;
+@@ -18890,7 +18891,7 @@ static bool
+ aarch64_handle_attr_isa_flags (char *str)
+ {
+ enum aarch64_parse_opt_result parse_res;
+- uint64_t isa_flags = aarch64_isa_flags;
++ auto isa_flags = aarch64_isa_flags;
+
+ /* We allow "+nothing" in the beginning to clear out all architectural
+ features if the user wants to handpick specific features. */
+@@ -19162,7 +19163,7 @@ aarch64_process_target_attr (tree args)
+ {
+ /* Check if token is possibly an arch extension without
+ leading '+'. */
+- uint64_t isa_temp = 0;
++ aarch64_feature_flags isa_temp = 0;
+ auto with_plus = std::string ("+") + token;
+ enum aarch64_parse_opt_result ext_res
+ = aarch64_parse_extension (with_plus.c_str (), &isa_temp, nullptr);
+@@ -22771,7 +22772,7 @@ aarch64_declare_function_name (FILE *stream, const char* name,
+ const struct processor *this_arch
+ = aarch64_get_arch (targ_options->x_selected_arch);
+
+- uint64_t isa_flags = targ_options->x_aarch64_isa_flags;
++ auto isa_flags = targ_options->x_aarch64_isa_flags;
+ std::string extension
+ = aarch64_get_extension_string_for_isa_flags (isa_flags,
+ this_arch->flags);
+@@ -22901,7 +22902,7 @@ aarch64_start_file (void)
+
+ const struct processor *default_arch
+ = aarch64_get_arch (default_options->x_selected_arch);
+- uint64_t default_isa_flags = default_options->x_aarch64_isa_flags;
++ auto default_isa_flags = default_options->x_aarch64_isa_flags;
+ std::string extension
+ = aarch64_get_extension_string_for_isa_flags (default_isa_flags,
+ default_arch->flags);
+diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
+index 836a3c784..47ec7824f 100644
+--- a/gcc/config/aarch64/aarch64.opt
++++ b/gcc/config/aarch64/aarch64.opt
+@@ -28,7 +28,7 @@ TargetVariable
+ enum aarch64_arch selected_arch = aarch64_no_arch
+
+ TargetVariable
+-uint64_t aarch64_isa_flags = 0
++aarch64_feature_flags aarch64_isa_flags = 0
+
+ TargetVariable
+ unsigned aarch64_enable_bti = 2
+diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc
+index ee9cb65a5..2ae47c020 100644
+--- a/gcc/config/aarch64/driver-aarch64.cc
++++ b/gcc/config/aarch64/driver-aarch64.cc
+@@ -31,7 +31,7 @@
+ struct aarch64_arch_extension
+ {
+ const char *ext;
+- uint64_t flag;
++ aarch64_feature_flags flag;
+ const char *feat_string;
+ };
+
+@@ -50,7 +50,7 @@ struct aarch64_core_data
+ unsigned char implementer_id; /* Exactly 8 bits */
+ unsigned int part_no; /* 12 bits + 12 bits */
+ unsigned variant;
+- uint64_t flags;
++ aarch64_feature_flags flags;
+ };
+
+ #define AARCH64_BIG_LITTLE(BIG, LITTLE) \
+@@ -75,7 +75,7 @@ struct aarch64_arch_driver_info
+ {
+ const char* id;
+ const char* name;
+- uint64_t flags;
++ aarch64_feature_flags flags;
+ };
+
+ /* Skip the leading "V" in the architecture name. */
+@@ -261,8 +261,8 @@ host_detect_local_cpu (int argc, const char **argv)
+ unsigned int variants[2] = { ALL_VARIANTS, ALL_VARIANTS };
+ unsigned int n_variants = 0;
+ bool processed_exts = false;
+- uint64_t extension_flags = 0;
+- uint64_t default_flags = 0;
++ aarch64_feature_flags extension_flags = 0;
++ aarch64_feature_flags default_flags = 0;
+ std::string buf;
+ size_t sep_pos = -1;
+ char *fcpu_info;
+--
+2.33.0
+