[Intel-gfx] xf86-video-intel (git-13461a1): BROKEN with clang-3.2 due to __cpuid() not available?
Sedat Dilek
sedat.dilek at gmail.com
Tue Feb 26 14:20:26 CET 2013
On Tue, Feb 26, 2013 at 1:58 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Tue, Feb 26, 2013 at 01:35:51PM +0100, Sedat Dilek wrote:
>> With xf86-video-intel-git13461a1 [1] I see this:
>>
>> [ build-log ]
>> ...
>> CC sna_cpu.lo
>> 8 warnings generated.
>> CC sna_damage.lo
>> CC sna_display.lo
>> sna_cpu.c:47:2: error: implicit declaration of function '__cpuid' is
>> invalid in C99 [-Werror,-Wimplicit-function-declaration]
>> __cpuid(1, eax, ebx, ecx, edx);
>> ^
> [snip]
>
>> So, clang should be treated differently?
>
> It doesn't use cpuid.h unless the compiler claims to be gcc >= 4. It
> would appear once again that clang is broken.
Can you explain why clang is BROKEN in your eyes?
So, this cpuid.h is from the compiler's include-dir?
If YES, there is no __cpuid() used/defined in clang's "cpuid.h".
clang has __get_cpuid()...
Substituting like this...
--- a/src/sna/sna_cpu.c
+++ b/src/sna/sna_cpu.c
@@ -44,7 +44,7 @@ unsigned sna_cpu_detect(void)
unsigned int eax, ebx, ecx, edx;
unsigned features = 0;
- __cpuid(1, eax, ebx, ecx, edx);
+ __get_cpuid(1, eax, ebx, ecx, edx);
if (eax & bit_SSE3)
features |= SSE3;
...leads to...
CC sna_cpu.lo
sna_cpu.c:47:17: warning: incompatible integer to pointer conversion
passing 'unsigned int' to parameter of type 'unsigned int *'; take the
address with & [-Wint-conversion]
__get_cpuid(1, eax, ebx, ecx, edx);
^~~
&
/opt/llvm/bin/../lib/clang/3.2/include/cpuid.h:28:66: note: passing
argument to parameter 'eax' here
static inline int __get_cpuid (unsigned int level, unsigned int *eax,
^
sna_cpu.c:47:22: warning: incompatible integer to pointer conversion
passing 'unsigned int' to parameter of type 'unsigned int *'; take the
address with & [-Wint-conversion]
__get_cpuid(1, eax, ebx, ecx, edx);
^~~
&
/opt/llvm/bin/../lib/clang/3.2/include/cpuid.h:29:46: note: passing
argument to parameter 'ebx' here
unsigned int *ebx, unsigned int *ecx,
^
sna_cpu.c:47:27: warning: incompatible integer to pointer conversion
passing 'unsigned int' to parameter of type 'unsigned int *'; take the
address with & [-Wint-conversion]
__get_cpuid(1, eax, ebx, ecx, edx);
^~~
&
/opt/llvm/bin/../lib/clang/3.2/include/cpuid.h:29:65: note: passing
argument to parameter 'ecx' here
unsigned int *ebx, unsigned int *ecx,
^
sna_cpu.c:47:32: warning: incompatible integer to pointer conversion
passing 'unsigned int' to parameter of type 'unsigned int *'; take the
address with & [-Wint-conversion]
__get_cpuid(1, eax, ebx, ecx, edx);
^~~
&
/opt/llvm/bin/../lib/clang/3.2/include/cpuid.h:30:46: note: passing
argument to parameter 'edx' here
unsigned int *edx) {
^
sna_cpu.c:49:12: error: use of undeclared identifier 'bit_SSE3'
if (eax & bit_SSE3)
^
sna_cpu.c:52:12: error: use of undeclared identifier 'bit_SSSE3'
if (eax & bit_SSSE3)
^
sna_cpu.c:55:12: error: use of undeclared identifier 'bit_SSE4_1'
if (eax & bit_SSE4_1)
^
sna_cpu.c:58:12: error: use of undeclared identifier 'bit_SSE4_2'
if (eax & bit_SSE4_2)
^
sna_cpu.c:61:12: error: use of undeclared identifier 'bit_AVX'
if (eax & bit_AVX)
^
sna_cpu.c:64:12: error: use of undeclared identifier 'bit_MMX'
if (edx & bit_MMX)
^
sna_cpu.c:67:12: error: use of undeclared identifier 'bit_SSE'
if (edx & bit_SSE)
^
sna_cpu.c:70:12: error: use of undeclared identifier 'bit_SSE2'
if (edx & bit_SSE2)
^
sna_cpu.c:73:12: error: use of undeclared identifier 'bit_SSE4a'
if (edx & bit_SSE4a)
^
sna_cpu.c:76:2: error: implicit declaration of function '__cpuid' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
__cpuid(7, eax, ebx, ecx, edx);
^
4 warnings and 10 errors generated.
make[3]: *** [sna_cpu.lo] Error 1
>From my understanding this happens as all those bit_XXX are not
defined in clang's cpuid.h!
Whereas gcc's cpuid.h has them:
$ grep bit_SSE /usr/lib/gcc/x86_64-linux-gnu/4.6/include/cpuid.h
#define bit_SSE3 (1 << 0)
#define bit_SSE4_1 (1 << 19)
#define bit_SSE4_2 (1 << 20)
#define bit_SSE (1 << 25)
#define bit_SSE2 (1 << 26)
#define bit_SSE4a (1 << 6)
Did you had a look at the attached cpuid.h files from gcc-4.6 and
llvm-3.2/clang-3.2?
Regards,
- Sedat -
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list