From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KozNN-0007uB-9e for qemu-devel@nongnu.org; Sun, 12 Oct 2008 07:44:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KozNI-0007tR-GA for qemu-devel@nongnu.org; Sun, 12 Oct 2008 07:44:44 -0400 Received: from [199.232.76.173] (port=53076 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KozNI-0007tO-D9 for qemu-devel@nongnu.org; Sun, 12 Oct 2008 07:44:40 -0400 Received: from savannah.gnu.org ([199.232.41.3]:48692 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KozNI-0006wY-94 for qemu-devel@nongnu.org; Sun, 12 Oct 2008 07:44:40 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KozNG-0000r9-OD for qemu-devel@nongnu.org; Sun, 12 Oct 2008 11:44:39 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KozNF-0000r1-S2 for qemu-devel@nongnu.org; Sun, 12 Oct 2008 11:44:38 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sun, 12 Oct 2008 11:44:37 +0000 Subject: [Qemu-devel] [5466] Only use __builtin_* with GCC >= 3.4 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5466 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5466 Author: aurel32 Date: 2008-10-12 11:44:36 +0000 (Sun, 12 Oct 2008) Log Message: ----------- Only use __builtin_* with GCC >= 3.4 Fix gcc 3.3 builds, broken in revision 5465. Signed-off-by: Aurelien Jarno Revision Links: -------------- http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5465 Modified Paths: -------------- trunk/host-utils.h trunk/hw/apic.c Modified: trunk/host-utils.h =================================================================== --- trunk/host-utils.h 2008-10-12 00:53:17 UTC (rev 5465) +++ trunk/host-utils.h 2008-10-12 11:44:36 UTC (rev 5466) @@ -51,7 +51,7 @@ static always_inline int clz32(uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_clz(val); else @@ -93,7 +93,7 @@ static always_inline int clz64(uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_clzll(val); else @@ -118,7 +118,7 @@ static always_inline int ctz32 (uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_ctz(val); else @@ -162,7 +162,7 @@ static always_inline int ctz64 (uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_ctz(val); else @@ -206,7 +206,7 @@ static always_inline int ctpop32 (uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return __builtin_popcount(val); #else val = (val & 0x55555555) + ((val >> 1) & 0x55555555); @@ -221,7 +221,7 @@ static always_inline int ctpop64 (uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return __builtin_popcountll(val); #else val = (val & 0x5555555555555555ULL) + ((val >> 1) & 0x5555555555555555ULL); Modified: trunk/hw/apic.c =================================================================== --- trunk/hw/apic.c 2008-10-12 00:53:17 UTC (rev 5465) +++ trunk/hw/apic.c 2008-10-12 11:44:36 UTC (rev 5466) @@ -107,7 +107,7 @@ /* Find first bit starting from msb */ static int fls_bit(uint32_t value) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return 31 - __builtin_clz(value); #else unsigned int ret = 0; @@ -127,7 +127,7 @@ /* Find first bit starting from lsb */ static int ffs_bit(uint32_t value) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return __builtin_ffs(value) - 1; #else unsigned int ret = 0;