summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qprocessordetection.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-12-03 16:51:05 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-12-21 13:33:21 +0000
commit32e4546cc3b38dd8a15eaac07dc79c48acea5ce7 (patch)
treec6687572da848b8a659057769ff77b9d90b0a214 /src/corelib/global/qprocessordetection.h
parentf25298bd11cf03a9e7af63ae5512c8ab8b47b306 (diff)
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>
Diffstat (limited to 'src/corelib/global/qprocessordetection.h')
-rw-r--r--src/corelib/global/qprocessordetection.h47
1 files changed, 27 insertions, 20 deletions
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 4b75872bb6..f80e9c1535 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -88,44 +88,51 @@
auto-detection implemented below.
*/
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
-# define Q_PROCESSOR_ARM
# if defined(__aarch64__)
# define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8
# else
# define Q_PROCESSOR_ARM_32
# endif
-# if defined(__ARM64_ARCH_8__)
-# define Q_PROCESSOR_ARM_V8
-# define Q_PROCESSOR_ARM_V7
-# define Q_PROCESSOR_ARM_V6
-# define Q_PROCESSOR_ARM_V5
+# if defined(__ARM_ARCH) && __ARM_ARCH > 1
+# define Q_PROCESSOR_ARM __ARM_ARCH
+# elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
+# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
+# 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__) \
|| defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) \
|| defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7S__) \
- || defined(_ARM_ARCH_7) \
- || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \
- || (defined(_M_ARM) && _M_ARM-0 >= 7)
-# define Q_PROCESSOR_ARM_V7
-# define Q_PROCESSOR_ARM_V6
-# define Q_PROCESSOR_ARM_V5
+ || defined(_ARM_ARCH_7)
+# define Q_PROCESSOR_ARM 7
# elif defined(__ARM_ARCH_6__) \
|| defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6T2__) \
|| 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(_M_ARM) && _M_ARM-0 >= 6)
-# define Q_PROCESSOR_ARM_V6
-# define Q_PROCESSOR_ARM_V5
+ || defined(__ARM_ARCH_6M__)
+# define Q_PROCESSOR_ARM 6
# elif defined(__ARM_ARCH_5TEJ__) \
- || defined(__ARM_ARCH_5TE__) \
- || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) \
- || (defined(_M_ARM) && _M_ARM-0 >= 5)
+ || defined(__ARM_ARCH_5TE__)
+# define Q_PROCESSOR_ARM 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
# endif
# if defined(__ARMEL__)