From owner-svn-src-head@freebsd.org Mon Dec 4 01:16:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6042E6F965; Mon, 4 Dec 2017 01:16:27 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 904CA72471; Mon, 4 Dec 2017 01:16:27 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB41GQ7N078527; Mon, 4 Dec 2017 01:16:26 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB41GQ41078524; Mon, 4 Dec 2017 01:16:26 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201712040116.vB41GQ41078524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Mon, 4 Dec 2017 01:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326506 - in head/sys/contrib/zstd/lib: common compress X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: in head/sys/contrib/zstd/lib: common compress X-SVN-Commit-Revision: 326506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 01:16:27 -0000 Author: allanjude Date: Mon Dec 4 01:16:26 2017 New Revision: 326506 URL: https://svnweb.freebsd.org/changeset/base/326506 Log: Use __has_builtin() to ensure clz and clzll builtins are available The existing check of the GCC version number is not sufficient This fixes the build on sparc64 in preparation for integrating ZSTD into the kernel for ZFS and Crash Dumps. Modified: head/sys/contrib/zstd/lib/common/bitstream.h head/sys/contrib/zstd/lib/common/zstd_internal.h head/sys/contrib/zstd/lib/compress/zstd_compress.h Modified: head/sys/contrib/zstd/lib/common/bitstream.h ============================================================================== --- head/sys/contrib/zstd/lib/common/bitstream.h Mon Dec 4 01:14:17 2017 (r326505) +++ head/sys/contrib/zstd/lib/common/bitstream.h Mon Dec 4 01:16:26 2017 (r326506) @@ -175,7 +175,7 @@ MEM_STATIC unsigned BIT_highbit32 (register U32 val) unsigned long r=0; _BitScanReverse ( &r, val ); return (unsigned) r; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ +# elif defined(__GNUC__) && (__GNUC__ >= 3) && __has_builtin(__builtin_clz) /* Use GCC Intrinsic */ return 31 - __builtin_clz (val); # else /* Software version */ static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, Modified: head/sys/contrib/zstd/lib/common/zstd_internal.h ============================================================================== --- head/sys/contrib/zstd/lib/common/zstd_internal.h Mon Dec 4 01:14:17 2017 (r326505) +++ head/sys/contrib/zstd/lib/common/zstd_internal.h Mon Dec 4 01:16:26 2017 (r326506) @@ -327,7 +327,7 @@ MEM_STATIC U32 ZSTD_highbit32(U32 val) unsigned long r=0; _BitScanReverse(&r, val); return (unsigned)r; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC Intrinsic */ +# elif defined(__GNUC__) && (__GNUC__ >= 3) && __has_builtin(__builtin_clz) /* GCC Intrinsic */ return 31 - __builtin_clz(val); # else /* Software version */ static const int DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; Modified: head/sys/contrib/zstd/lib/compress/zstd_compress.h ============================================================================== --- head/sys/contrib/zstd/lib/compress/zstd_compress.h Mon Dec 4 01:14:17 2017 (r326505) +++ head/sys/contrib/zstd/lib/compress/zstd_compress.h Mon Dec 4 01:16:26 2017 (r326506) @@ -203,7 +203,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t va unsigned long r = 0; _BitScanReverse64( &r, val ); return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 4) +# elif defined(__GNUC__) && (__GNUC__ >= 4) && __has_builtin(__builtin_clzll) return (__builtin_clzll(val) >> 3); # else unsigned r; @@ -218,7 +218,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t va unsigned long r = 0; _BitScanReverse( &r, (unsigned long)val ); return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) +# elif defined(__GNUC__) && (__GNUC__ >= 3) && __has_builtin(__builtin_clz) return (__builtin_clz((U32)val) >> 3); # else unsigned r;