Unverified Commit d72de0c7 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2619 from mark-mb/master

ARM64 support
parents 6fcb3b29 29290598
......@@ -41,7 +41,11 @@ if ("${TARGET_ARCH}" MATCHES "x86_64|i386")
endif()
if ("${TARGET_ARCH}" MATCHES "arm")
set(ARM ON)
if ("${TARGET_ARCH}" MATCHES "armv8")
add_compile_definitions(__ARM64__=1)
else()
add_compile_definitions(__ARM__=1)
endif()
endif()
if ("${TARGET_ARCH}" MATCHES "ppc")
set(PPC ON)
......
......@@ -24,19 +24,40 @@
# OF THE POSSIBILITY OF SUCH DAMAGE.
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
# https://github.com/qt/qtbase/blob/9a6a847/src/corelib/global/qprocessordetection.h
# Currently handles arm / aarch64 (v5, v6, v7, v8), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
#define _STR(x) #x
#define STR(x) _STR(x)
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || \\
defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
#if defined(__ARM_ARCH) && __ARM_ARCH > 1
#pragma message \"cmake_ARCH armv\" STR(__ARM_ARCH)
#error
#elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
#pragma message \"cmake_ARCH armv\" STR(__TARGET_ARCH_ARM)
#error
#elif defined(_M_ARM) && _M_ARM > 1
#error cmake_ARCH arm ## __M_ARM
#elif defined(__ARM64_ARCH_8__) \\
|| defined(__aarch64__) \\
|| defined(__ARMv8__) \\
|| defined(__ARMv8_A__) \\
|| defined(_M_ARM64)
#error cmake_ARCH armv8
#elif defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|| defined(__ARM_ARCH_7S__) \\
|| defined(_ARM_ARCH_7) \\
|| defined(__CORE_CORTEXA__)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
......@@ -44,11 +65,10 @@ set(archdetect_c_code "
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|| defined(__ARM_ARCH_6M__)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|| defined(__ARM_ARCH_5TE__)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
......
#if defined(__ANDROID__)
#if defined(__ARM__) || defined(__ARM64__)
#include "neon_mathfun.h"
#else
#if !defined(__PNACL__)
......
......@@ -93,7 +93,8 @@ static int getNumProcessors() {
#ifdef WIN32
#define cpuid __cpuid
#else
#if !defined(__ANDROID__) && !defined(__PNACL__) && !defined(__PPC__)
#if !defined(__ANDROID__) && !defined(__PNACL__) && !defined(__PPC__) \
&& !defined(__ARM__) && !defined(__ARM64__)
static void cpuid(int cpuInfo[4], int infoType){
#ifdef __LP64__
__asm__ __volatile__ (
......
......@@ -32,7 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#if defined(__ARM__)
#if defined(__ARM__) || defined(__ARM64__)
#include "vectorize_neon.h"
#elif defined(__PPC__)
#include "vectorize_ppc.h"
......
......@@ -32,7 +32,12 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#ifdef __ANDROID__
#include <cpu-features.h>
#else
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
#include <arm_neon.h>
#include <cmath>
......@@ -48,8 +53,16 @@ float32x4_t log_ps(float32x4_t);
* Determine whether ivec4 and fvec4 are supported on this processor.
*/
static bool isVec4Supported() {
#ifdef __ANDROID__
uint64_t features = android_getCpuFeatures();
return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
#elif defined(__ARM__)
unsigned long features = getauxval(AT_HWCAP);
return (features & HWCAP_NEON) != 0;
#else
unsigned long features = getauxval(AT_HWCAP);
return (features & HWCAP_ASIMD) != 0;
#endif
}
class ivec4;
......
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