aom: aarch64_cpudetect.c: Don't read AT_HWCAPs if they are not needed (9972e)

From 9972ec4bdfbf4412b3ecafc9f76fc582080afbf8 Mon Sep 17 00:00:00 2001
From: George Steed <[EMAIL REDACTED]>
Date: Wed, 7 Feb 2024 15:38:54 +0000
Subject: [PATCH] aarch64_cpudetect.c: Don't read AT_HWCAPs if they are not

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
(cherry picked from commit 2036fbe2d8449c1054b4fb8bdf22c78f92655afc)
 aom_ports/aarch64_cpudetect.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/aom_ports/aarch64_cpudetect.c b/aom_ports/aarch64_cpudetect.c
index 43d5a149c8..13299a688e 100644
--- a/aom_ports/aarch64_cpudetect.c
+++ b/aom_ports/aarch64_cpudetect.c
@@ -108,8 +108,13 @@ static int arm_get_cpu_caps(void) {
 static int arm_get_cpu_caps(void) {
   int flags = 0;
   unsigned long hwcap = getauxval(AT_HWCAP);
   unsigned long hwcap2 = getauxval(AT_HWCAP2);
   flags |= HAS_NEON;  // Neon is mandatory in Armv8.0-A.
 #endif  // HAVE_NEON