From patchwork Tue Feb 26 13:20:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sedat Dilek X-Patchwork-Id: 2185511 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 2CB0C3FCF2 for ; Tue, 26 Feb 2013 13:33:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C52E5E64E8 for ; Tue, 26 Feb 2013 05:33:56 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f169.google.com (mail-we0-f169.google.com [74.125.82.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 26850E64CB for ; Tue, 26 Feb 2013 05:20:28 -0800 (PST) Received: by mail-we0-f169.google.com with SMTP id t11so3660505wey.28 for ; Tue, 26 Feb 2013 05:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=BOWcgQzfwx8+Mwy8D4DTE5aWHhRgCORE4PhXKtNNmu0=; b=xAEmyFwoKOFysvP5jqYswitW/0SB3ljiBise56XAWTxPSKMCdEiAC71BOSoULCqif8 ZWSDGQNiCqAI1kpAKZVJqAeinD/8QHxonCv/O1BH5vfOhiqPKNujVPvpcYYxKYb2hriP sEHfBoxZFvweFIBpMwLfzacx4Pq9tXSpg0R2tfVju/VouHri2LjkFt6553ZMmmXBFI+1 Sgnpddiw9jPeUtVxKbkH/X9W12J4VZy8humn3+QkrtITKiJe7xnUqh8AAUwiymzFNJt+ N6GFOVQVoOyOddlwB1sSgJeu+CvyNZzyqFyf0lK/nuosCPA0IPeXVfpdY0j6mBUkXGXY HLVg== MIME-Version: 1.0 X-Received: by 10.194.92.231 with SMTP id cp7mr26332465wjb.19.1361884826820; Tue, 26 Feb 2013 05:20:26 -0800 (PST) Received: by 10.216.94.68 with HTTP; Tue, 26 Feb 2013 05:20:26 -0800 (PST) In-Reply-To: <20130226125805.GA31444@cantiga.alporthouse.com> References: <20130226125805.GA31444@cantiga.alporthouse.com> Date: Tue, 26 Feb 2013 14:20:26 +0100 Message-ID: From: Sedat Dilek To: Chris Wilson , Sedat Dilek , intel-gfx Subject: Re: [Intel-gfx] xf86-video-intel (git-13461a1): BROKEN with clang-3.2 due to __cpuid() not available? X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: sedat.dilek@gmail.com List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org On Tue, Feb 26, 2013 at 1:58 PM, Chris Wilson 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... ...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 --- 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;