arm_cpudetect: fix aom_arm_cpu_caps w/Win Arm64
This allows clang-cl to build the library; the Visual Studio compiler
will still fail due to some NEON code expecting the NEON types to be a
vector type.
Bug: b/277255390
Change-Id: I5b934afe1a0b301c2bf41d701c329b47ab1bbf91
diff --git a/aom_ports/arm_cpudetect.c b/aom_ports/arm_cpudetect.c
index 23d3aa5..c914d04 100644
--- a/aom_ports/arm_cpudetect.c
+++ b/aom_ports/arm_cpudetect.c
@@ -57,10 +57,14 @@
}
#elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT || __APPLE__ */
+#if HAVE_NEON && \
+ !(defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC))
/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
+#endif // HAVE_NEON &&
+ // !(defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC))
int aom_arm_cpu_caps(void) {
int flags;
@@ -69,6 +73,9 @@
return flags;
}
mask = arm_cpu_env_mask();
+#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
+ return HAS_NEON & mask;
+#else
/* MSVC has no inline __asm support for ARM, but it does let you __emit
* instructions via their assembled hex code.
* All of these instructions should be essentially nops.
@@ -83,8 +90,9 @@
/*Ignore exception.*/
}
}
-#endif /* HAVE_NEON */
+#endif /* HAVE_NEON */
return flags & mask;
+#endif // defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
}
#elif defined(__ANDROID__) /* end _MSC_VER */