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>
This commit is contained in:
Chris Wilson 2013-02-26 08:15:47 +00:00
parent 49d9c5e9d4
commit 528dbf9ebb
1 changed files with 15 additions and 0 deletions

View File

@ -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