Commit 8dcdacc5 authored by Johann's avatar Johann
Browse files

Restructure ARM assumptions in cpudetect

Allow building for targets which have NEON but not EDSP or MEDIA.

Set HAS_NEON flag for builds which have neon assembly but not
intrinsics.

Change-Id: Ibfa81a8444a8c55d1d3209c533d1d70d2f809669
parent 619951af
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "arm.h" #include "vpx_ports/arm.h"
#include "./vpx_config.h"
#ifdef WINAPI_FAMILY #ifdef WINAPI_FAMILY
#include <winapifamily.h> #include <winapifamily.h>
...@@ -54,9 +55,9 @@ int arm_cpu_caps(void) { ...@@ -54,9 +55,9 @@ int arm_cpu_caps(void) {
#if HAVE_MEDIA #if HAVE_MEDIA
flags |= HAS_MEDIA; flags |= HAS_MEDIA;
#endif /* HAVE_MEDIA */ #endif /* HAVE_MEDIA */
#if HAVE_NEON #if HAVE_NEON || HAVE_NEON_ASM
flags |= HAS_NEON; flags |= HAS_NEON;
#endif /* HAVE_NEON */ #endif /* HAVE_NEON || HAVE_NEON_ASM */
return flags & mask; return flags & mask;
} }
...@@ -87,6 +88,7 @@ int arm_cpu_caps(void) { ...@@ -87,6 +88,7 @@ int arm_cpu_caps(void) {
/*Ignore exception.*/ /*Ignore exception.*/
} }
} }
#endif /* HAVE_EDSP */
#if HAVE_MEDIA #if HAVE_MEDIA
if (mask & HAS_MEDIA) if (mask & HAS_MEDIA)
__try { __try {
...@@ -97,7 +99,8 @@ int arm_cpu_caps(void) { ...@@ -97,7 +99,8 @@ int arm_cpu_caps(void) {
/*Ignore exception.*/ /*Ignore exception.*/
} }
} }
#if HAVE_NEON #endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
if (mask &HAS_NEON) { if (mask &HAS_NEON) {
__try { __try {
/*VORR q0,q0,q0*/ /*VORR q0,q0,q0*/
...@@ -107,9 +110,7 @@ if (mask &HAS_NEON) { ...@@ -107,9 +110,7 @@ if (mask &HAS_NEON) {
/*Ignore exception.*/ /*Ignore exception.*/
} }
} }
#endif /* HAVE_NEON */ #endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_MEDIA */
#endif /* HAVE_EDSP */
return flags & mask; return flags & mask;
} }
...@@ -132,10 +133,10 @@ int arm_cpu_caps(void) { ...@@ -132,10 +133,10 @@ int arm_cpu_caps(void) {
#if HAVE_MEDIA #if HAVE_MEDIA
flags |= HAS_MEDIA; flags |= HAS_MEDIA;
#endif /* HAVE_MEDIA */ #endif /* HAVE_MEDIA */
#if HAVE_NEON #if HAVE_NEON || HAVE_NEON_ASM
if (features & ANDROID_CPU_ARM_FEATURE_NEON) if (features & ANDROID_CPU_ARM_FEATURE_NEON)
flags |= HAS_NEON; flags |= HAS_NEON;
#endif /* HAVE_NEON */ #endif /* HAVE_NEON || HAVE_NEON_ASM */
return flags & mask; return flags & mask;
} }
...@@ -162,7 +163,7 @@ int arm_cpu_caps(void) { ...@@ -162,7 +163,7 @@ int arm_cpu_caps(void) {
*/ */
char buf[512]; char buf[512];
while (fgets(buf, 511, fin) != NULL) { while (fgets(buf, 511, fin) != NULL) {
#if HAVE_EDSP || HAVE_NEON #if HAVE_EDSP || HAVE_NEON || HAVE_NEON_ASM
if (memcmp(buf, "Features", 8) == 0) { if (memcmp(buf, "Features", 8) == 0) {
char *p; char *p;
#if HAVE_EDSP #if HAVE_EDSP
...@@ -170,15 +171,15 @@ int arm_cpu_caps(void) { ...@@ -170,15 +171,15 @@ int arm_cpu_caps(void) {
if (p != NULL && (p[5] == ' ' || p[5] == '\n')) { if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
flags |= HAS_EDSP; flags |= HAS_EDSP;
} }
#if HAVE_NEON #endif /* HAVE_EDSP */
#if HAVE_NEON || HAVE_NEON_ASM
p = strstr(buf, " neon"); p = strstr(buf, " neon");
if (p != NULL && (p[5] == ' ' || p[5] == '\n')) { if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
flags |= HAS_NEON; flags |= HAS_NEON;
} }
#endif /* HAVE_NEON */ #endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_EDSP */
} }
#endif /* HAVE_EDSP || HAVE_NEON */ #endif /* HAVE_EDSP || HAVE_NEON || HAVE_NEON_ASM */
#if HAVE_MEDIA #if HAVE_MEDIA
if (memcmp(buf, "CPU architecture:", 17) == 0) { if (memcmp(buf, "CPU architecture:", 17) == 0) {
int version; int version;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment