diff options
author | Matthew Malcomson <matthew.malcomson@arm.com> | 2019-05-22 16:09:59 +0000 |
---|---|---|
committer | Matthew Malcomson <matmal01@gcc.gnu.org> | 2019-05-22 16:09:59 +0000 |
commit | 28108a5341653568e9ebc49ea755ff93cc1e1711 (patch) | |
tree | 9ca112acb2ac02b30f6a2915b2e521941130003a /gcc/common | |
parent | ee49c5a4513c99c8013c5cd1598559c5e4c2810c (diff) | |
download | gcc-28108a5341653568e9ebc49ea755ff93cc1e1711.zip gcc-28108a5341653568e9ebc49ea755ff93cc1e1711.tar.gz gcc-28108a5341653568e9ebc49ea755ff93cc1e1711.tar.bz2 |
[aarch64] Introduce flags for SVE2.
This patch adds support in the compiler for the architecture feature
flags that binutils will use to enable/disable the new "Future
Architecture Technologies" feature Scalable Vector Extension V2 (SVE2)
announced at Linaro Connect this week.
The "sve2" extension that enables the core sve2 instructions.
This also enables the sve extension, since sve is a requirement of sve2.
Extra optional sve2 features are the bitperm, sm4, aes, and sha3 extensions.
These are all given extra feature flags, "bitperm", "sve2-sm4",
"sve2-aes", and "sve2-sha3" respectively.
The sm4, aes, and sha3 extensions are explicitly marked as sve2
extensions to distinguish them from the corresponding NEON extensions.
When introducing macros to denote these new features we have gone past
what a 32 bit value can represent which means we need to change the type
of those variables working with these feature flags to ensure they use
64 bit quantities.
Tested with bootstrap on aarch64-none-linux-gnu and manually seeing that
-march=armv8-a+typo prints out the expected flags while using the new
feature flags does not complain about a missing flag (until reaching the
assembler).
gcc/ChangeLog:
2019-05-22 Matthew Malcomson <matthew.malcomson@arm.com>
* common/config/aarch64/aarch64-common.c
(struct aarch64_option_extension, struct processor_name_to_arch,
struct arch_to_arch_name, aarch64_parse_extension, opt_ext_cmp,
aarch64_contains_opt,
aarch64_get_extension_string_for_isa_flags): Change type of
variables storing flags to uint64_t.
* config/aarch64/aarch64-option-extensions.def (sve2, sve2-sm4,
sve2-aes, sve2-sha3, bitperm): New optional SVE2 extension flags.
* config/aarch64/aarch64.c (struct processor,
aarch64_parse_arch, aarch64_parse_cpu, aarch64_validate_mcpu,
aarch64_validate_march, aarch64_override_options,
aarch64_option_print, aarch64_handle_attr_isa_flags,
aarch64_declare_function_name, aarch64_start_file): Make flag
variables uint64_t.
* config/aarch64/aarch64.h (AARCH64_FL_SVE2, AARCH64_FL_SVE2_AES,
AARCH64_FL_SVE2_SM4, AARCH64_FL_SVE2_SHA3,
AARCH64_FL_SVE2_BITPERM): New macro feature flags.
* config/aarch64/aarch64.opt (aarch64_isa_flags): Make uint64_t.
* config/aarch64/driver-aarch64.c
(struct aarch64_arch_extension, struct aarch64_core_data,
struct aarch64_arch_driver_info, host_detect_local_cpu): Make
flag variables uint64_t.
* doc/invoke.texi: Add documentation for new arguments.
From-SVN: r271514
Diffstat (limited to 'gcc/common')
-rw-r--r-- | gcc/common/config/aarch64/aarch64-common.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c index bab3ab3..f905105 100644 --- a/gcc/common/config/aarch64/aarch64-common.c +++ b/gcc/common/config/aarch64/aarch64-common.c @@ -170,9 +170,9 @@ aarch64_handle_option (struct gcc_options *opts, struct aarch64_option_extension { const char *const name; - const unsigned long flag_canonical; - const unsigned long flags_on; - const unsigned long flags_off; + const uint64_t flag_canonical; + const uint64_t flags_on; + const uint64_t flags_off; const bool is_synthetic; }; @@ -201,14 +201,14 @@ struct processor_name_to_arch { const std::string processor_name; const enum aarch64_arch arch; - const unsigned long flags; + const uint64_t flags; }; struct arch_to_arch_name { const enum aarch64_arch arch; const std::string arch_name; - const unsigned long flags; + const uint64_t flags; }; /* Map processor names to the architecture revision they implement and @@ -238,7 +238,7 @@ static const struct 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, unsigned long *isa_flags, +aarch64_parse_extension (const char *str, uint64_t *isa_flags, std::string *invalid_extension) { /* The extension string is parsed left to right. */ @@ -326,18 +326,21 @@ int opt_ext_cmp (const void* a, const void* b) turns on as a dependency. As an example +dotprod turns on FL_DOTPROD and FL_SIMD. As such the set of bits represented by this option is {FL_DOTPROD, FL_SIMD}. */ - unsigned long total_flags_a = opt_a->flag_canonical & opt_a->flags_on; - unsigned long total_flags_b = opt_b->flag_canonical & opt_b->flags_on; + uint64_t total_flags_a = opt_a->flag_canonical & opt_a->flags_on; + uint64_t total_flags_b = opt_b->flag_canonical & opt_b->flags_on; int popcnt_a = popcount_hwi ((HOST_WIDE_INT)total_flags_a); int popcnt_b = popcount_hwi ((HOST_WIDE_INT)total_flags_b); int order = popcnt_b - popcnt_a; /* If they have the same amount of bits set, give it a more deterministic ordering by using the value of the bits themselves. */ - if (order == 0) - return total_flags_b - total_flags_a; + if (order != 0) + return order; - return order; + if (total_flags_a != total_flags_b) + return total_flags_a < total_flags_b ? 1 : -1; + + return 0; } /* Implement TARGET_OPTION_INIT_STRUCT. */ @@ -373,9 +376,9 @@ aarch64_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED) */ static bool -aarch64_contains_opt (unsigned long isa_flag_bits, opt_ext *opt) +aarch64_contains_opt (uint64_t isa_flag_bits, opt_ext *opt) { - unsigned long flags_check + uint64_t flags_check = opt->is_synthetic ? opt->flags_on : opt->flag_canonical; return (isa_flag_bits & flags_check) == flags_check; @@ -388,13 +391,13 @@ aarch64_contains_opt (unsigned long isa_flag_bits, opt_ext *opt) that all the "+" flags come before the "+no" flags. */ std::string -aarch64_get_extension_string_for_isa_flags (unsigned long isa_flags, - unsigned long default_arch_flags) +aarch64_get_extension_string_for_isa_flags (uint64_t isa_flags, + uint64_t default_arch_flags) { const struct aarch64_option_extension *opt = NULL; std::string outstr = ""; - unsigned long isa_flag_bits = isa_flags; + uint64_t isa_flag_bits = isa_flags; /* Pass one: Minimize the search space by reducing the set of options to the smallest set that still turns on the same features as before in |