diff options
Diffstat (limited to 'gcc/common/config/aarch64/aarch64-common.cc')
-rw-r--r-- | gcc/common/config/aarch64/aarch64-common.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc index 20bc4e1..673407c 100644 --- a/gcc/common/config/aarch64/aarch64-common.cc +++ b/gcc/common/config/aarch64/aarch64-common.cc @@ -310,6 +310,7 @@ aarch64_get_extension_string_for_isa_flags But in order to make the output more readable, it seems better to add the strings in definition order. */ aarch64_feature_flags added = 0; + auto flags_crypto = AARCH64_FL_AES | AARCH64_FL_SHA2; for (unsigned int i = ARRAY_SIZE (all_extensions); i-- > 0; ) { auto &opt = all_extensions[i]; @@ -319,7 +320,7 @@ aarch64_get_extension_string_for_isa_flags per-feature crypto flags. */ auto flags = opt.flag_canonical; if (flags == AARCH64_FL_CRYPTO) - flags = AARCH64_FL_AES | AARCH64_FL_SHA2; + flags = flags_crypto; if ((flags & isa_flags & (explicit_flags | ~current_flags)) == flags) { @@ -338,14 +339,32 @@ aarch64_get_extension_string_for_isa_flags not have an HWCAPs then it shouldn't be taken into account for feature detection because one way or another we can't tell if it's available or not. */ + for (auto &opt : all_extensions) - if (opt.native_detect_p - && (opt.flag_canonical & current_flags & ~isa_flags)) - { - current_flags &= ~opt.flags_off; - outstr += "+no"; - outstr += opt.name; - } + { + auto flags = opt.flag_canonical; + /* As a special case, don't emit "+noaes" or "+nosha2" when we could emit + "+nocrypto" instead, in order to support assemblers that predate the + separate per-feature crypto flags. Only allow "+nocrypto" when "sm4" + is not already enabled (to avoid dependending on whether "+nocrypto" + also disables "sm4"). */ + if (flags & flags_crypto + && (flags_crypto & current_flags & ~isa_flags) == flags_crypto + && !(current_flags & AARCH64_FL_SM4)) + continue; + + if (flags == AARCH64_FL_CRYPTO) + /* If either crypto flag needs removing here, then both do. */ + flags = flags_crypto; + + if (opt.native_detect_p + && (flags & current_flags & ~isa_flags)) + { + current_flags &= ~opt.flags_off; + outstr += "+no"; + outstr += opt.name; + } + } return outstr; } |