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];
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)
{
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;
}
aarch64_def_or_undef (TARGET_ILP32, "_ILP32", pfile);
aarch64_def_or_undef (TARGET_ILP32, "__ILP32__", pfile);
- aarch64_def_or_undef (TARGET_CRYPTO, "__ARM_FEATURE_CRYPTO", pfile);
+ aarch64_def_or_undef (TARGET_AES && TARGET_SHA2, "__ARM_FEATURE_CRYPTO", pfile);
aarch64_def_or_undef (TARGET_SIMD_RDMA, "__ARM_FEATURE_QRDMX", pfile);
aarch64_def_or_undef (TARGET_SVE, "__ARM_FEATURE_SVE", pfile);
cpp_undef (pfile, "__ARM_FEATURE_SVE_BITS");
#endif
-/* Macros to test ISA flags. */
+/* Macros to test ISA flags.
+
+ There is intentionally no macro for AARCH64_FL_CRYPTO, since this flag bit
+ is not always set when its constituent features are present.
+ Check (TARGET_AES && TARGET_SHA2) instead. */
#define AARCH64_ISA_SM_OFF (aarch64_isa_flags & AARCH64_FL_SM_OFF)
#define AARCH64_ISA_SM_ON (aarch64_isa_flags & AARCH64_FL_SM_ON)
#define AARCH64_ISA_V8A (aarch64_isa_flags & AARCH64_FL_V8A)
#define AARCH64_ISA_V8_1A (aarch64_isa_flags & AARCH64_FL_V8_1A)
#define AARCH64_ISA_CRC (aarch64_isa_flags & AARCH64_FL_CRC)
-#define AARCH64_ISA_CRYPTO (aarch64_isa_flags & AARCH64_FL_CRYPTO)
#define AARCH64_ISA_FP (aarch64_isa_flags & AARCH64_FL_FP)
#define AARCH64_ISA_SIMD (aarch64_isa_flags & AARCH64_FL_SIMD)
#define AARCH64_ISA_LSE (aarch64_isa_flags & AARCH64_FL_LSE)
#define AARCH64_FL_SCXTNUM AARCH64_FL_V8_5A
#define AARCH64_FL_ID_PFR2 AARCH64_FL_V8_5A
-/* Crypto is an optional extension to AdvSIMD. */
-#define TARGET_CRYPTO (AARCH64_ISA_CRYPTO)
-
/* SHA2 is an optional extension to AdvSIMD. */
#define TARGET_SHA2 (AARCH64_ISA_SHA2)
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+aes+sha3" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\+sha3\n} 1 } } */
return 0;
}
-/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto} 1 } } */
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 } } */
/* Check if individual bits that make up a grouping is specified that only the
grouping is kept. */