summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-08-06 13:40:45 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-22 02:04:39 +0200
commit065cff83119a58973d1e00434ade1d26012a09d5 (patch)
treef5c1bbb7f4cc4aa66403b4dd8672b39dbc39903f
parentc374f4441ab42d1849431bb42fec91a976a8e502 (diff)
Define Q_PROCESSOR_X86 to the x86 family
They are: 3 Intel 80386 or equivalent 4 Intel 80486 or equivalent 5 Intel Pentium, Pentium MMX, AMD K6 and a few others 6 everything since the Intel Pentium Pro and AMD Athlon By necessity, this means all 64-bit builds have a family of 6. That matches the family number that the CPUID instruction produces. Change-Id: I5dc7344976f8da65938f44310b89ade4fe3f1a28 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qprocessordetection.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 21f9c8f44f..ca7689c527 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -157,11 +157,33 @@
X86 is little-endian.
*/
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
-# define Q_PROCESSOR_X86
# define Q_PROCESSOR_X86_32
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
+
+/*
+ * We define Q_PROCESSOR_X86 == 6 for anything above a equivalent or better
+ * than a Pentium Pro (the processor whose architecture was called P6) or an
+ * Athlon.
+ *
+ * All processors since the Pentium III and the Athlon 4 have SSE support, so
+ * we use that to detect. That leaves the original Athlon, Pentium Pro and
+ * Pentium II.
+ */
+
+# if defined(_M_IX86)
+# define Q_PROCESSOR_X86 (_M_IX86/100)
+# elif defined(__i686__) || defined(__athlon__) || defined(__SSE__)
+# define Q_PROCESSOR_X86 6
+# elif defined(__i586__) || defined(__k6__)
+# define Q_PROCESSOR_X86 5
+# elif defined(__i486__)
+# define Q_PROCESSOR_X86 4
+# else
+# define Q_PROCESSOR_X86 3
+# endif
+
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
-# define Q_PROCESSOR_X86
+# define Q_PROCESSOR_X86 6
# define Q_PROCESSOR_X86_64
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN