summaryrefslogtreecommitdiff
path: root/src/sna/sna_cpu.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-02-26 08:15:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-02-26 08:17:44 +0000
commit528dbf9ebb2688f476ef283be59d0f2232159dcb (patch)
tree6c2f1e590236c1afdc7179683d54781ebc0d5673 /src/sna/sna_cpu.c
parent49d9c5e9d48d043a8366b6471128c999b5e887b0 (diff)
sna: Fix build on older GCC for cpuid()
We need to double check that the features we look for are supported by the compiler before doing so. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_cpu.c')
-rw-r--r--src/sna/sna_cpu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sna/sna_cpu.c b/src/sna/sna_cpu.c
index 65f6e040..c669eb87 100644
--- a/src/sna/sna_cpu.c
+++ b/src/sna/sna_cpu.c
@@ -31,8 +31,14 @@
#include "sna.h"
+#if defined(__GNUC__) && (__GNUC__ >= 4) /* 4.4 */
+
#include <cpuid.h>
+#ifndef bit_AVX2
+#define bit_AVX2 (1<<5)
+#endif
+
unsigned sna_cpu_detect(void)
{
unsigned int eax, ebx, ecx, edx;
@@ -74,3 +80,12 @@ unsigned sna_cpu_detect(void)
return features;
}
+
+#else
+
+unsigned sna_cpu_detect(void)
+{
+ return 0;
+}
+
+#endif