qprocessordetection.h: Fix detection of 32-bit ARMv8

This is more future-proof. It fixes the detection of 32-bit on ARMv8-A
processors since it uses the __ARM_ARCH macro that GCC and Clang
define. For MSVC, we use _M_ARM, which also contains the architecture
version. MSVC does not currently support ARMv8 code, but when it does,
this commit should make the support automatic.

I don't know which compiler defines __TARGET_ARM_ARCH, but support it
too.

Change-Id: I8de47ed6c7be4847b99bffff141c8ede54a849eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2015-12-03 16:51:05 -08:00
parent f25298bd11
commit 32e4546cc3

View File

@ -88,44 +88,51 @@
auto-detection implemented below. auto-detection implemented below.
*/ */
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) #if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
# define Q_PROCESSOR_ARM
# if defined(__aarch64__) # if defined(__aarch64__)
# define Q_PROCESSOR_ARM_64 # define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8 # define Q_PROCESSOR_WORDSIZE 8
# else # else
# define Q_PROCESSOR_ARM_32 # define Q_PROCESSOR_ARM_32
# endif # endif
# if defined(__ARM64_ARCH_8__) # if defined(__ARM_ARCH) && __ARM_ARCH > 1
# define Q_PROCESSOR_ARM_V8 # define Q_PROCESSOR_ARM __ARM_ARCH
# define Q_PROCESSOR_ARM_V7 # elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
# define Q_PROCESSOR_ARM_V6 # define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
# define Q_PROCESSOR_ARM_V5 # elif defined(_M_ARM) && _M_ARM > 1
# define Q_PROCESSOR_ARM _M_ARM
# elif defined(__ARM64_ARCH_8__)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \ # elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \ || defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) \ || defined(__ARM_ARCH_7R__) \
|| defined(__ARM_ARCH_7M__) \ || defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7S__) \ || defined(__ARM_ARCH_7S__) \
|| defined(_ARM_ARCH_7) \ || defined(_ARM_ARCH_7)
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \ # define Q_PROCESSOR_ARM 7
|| (defined(_M_ARM) && _M_ARM-0 >= 7)
# define Q_PROCESSOR_ARM_V7
# define Q_PROCESSOR_ARM_V6
# define Q_PROCESSOR_ARM_V5
# elif defined(__ARM_ARCH_6__) \ # elif defined(__ARM_ARCH_6__) \
|| defined(__ARM_ARCH_6J__) \ || defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6T2__) \ || defined(__ARM_ARCH_6T2__) \
|| defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6K__) \ || defined(__ARM_ARCH_6K__) \
|| defined(__ARM_ARCH_6ZK__) \ || defined(__ARM_ARCH_6ZK__) \
|| defined(__ARM_ARCH_6M__) \ || defined(__ARM_ARCH_6M__)
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) \ # define Q_PROCESSOR_ARM 6
|| (defined(_M_ARM) && _M_ARM-0 >= 6)
# define Q_PROCESSOR_ARM_V6
# define Q_PROCESSOR_ARM_V5
# elif defined(__ARM_ARCH_5TEJ__) \ # elif defined(__ARM_ARCH_5TEJ__) \
|| defined(__ARM_ARCH_5TE__) \ || defined(__ARM_ARCH_5TE__)
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) \ # define Q_PROCESSOR_ARM 5
|| (defined(_M_ARM) && _M_ARM-0 >= 5) # else
# define Q_PROCESSOR_ARM 0
# endif
# if Q_PROCESSOR_ARM >= 8
# define Q_PROCESSOR_ARM_V8
# endif
# if Q_PROCESSOR_ARM >= 7
# define Q_PROCESSOR_ARM_V7
# endif
# if Q_PROCESSOR_ARM >= 6
# define Q_PROCESSOR_ARM_V6
# endif
# if Q_PROCESSOR_ARM >= 5
# define Q_PROCESSOR_ARM_V5 # define Q_PROCESSOR_ARM_V5
# endif # endif
# if defined(__ARMEL__) # if defined(__ARMEL__)