aarch64_cpudetect.c: Don't read AT_HWCAPs if they are not needed
If FEAT_I8MM is not supported by the compiler then we do not test the
value from getauxval(AT_HWCAP2), leading to an unused variable warning.
To suppress this, only read the variable if we are going to use it,
which for now is only to check FEAT_I8MM. Also do similarly for AT_HWCAP
to match.
Bug: aomedia:3543
Change-Id: I855c255105cbfc448f64df317507dd9184731479
diff --git a/aom_ports/aarch64_cpudetect.c b/aom_ports/aarch64_cpudetect.c
index 43d5a14..13299a6 100644
--- a/aom_ports/aarch64_cpudetect.c
+++ b/aom_ports/aarch64_cpudetect.c
@@ -108,8 +108,13 @@
static int arm_get_cpu_caps(void) {
int flags = 0;
+#if HAVE_ARM_CRC32 || HAVE_NEON_DOTPROD || HAVE_SVE
unsigned long hwcap = getauxval(AT_HWCAP);
+#endif
+#if HAVE_NEON_I8MM
unsigned long hwcap2 = getauxval(AT_HWCAP2);
+#endif
+
#if HAVE_NEON
flags |= HAS_NEON; // Neon is mandatory in Armv8.0-A.
#endif // HAVE_NEON