From owner-svn-src-all@freebsd.org Thu Aug 3 22:28:32 2017 Return-Path: Delivered-To: svn-src-all@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 075E5DD6808; Thu, 3 Aug 2017 22:28:32 +0000 (UTC) (envelope-from cem@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 D62D76E05E; Thu, 3 Aug 2017 22:28:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v73MSUOi070877; Thu, 3 Aug 2017 22:28:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73MSU4L070875; Thu, 3 Aug 2017 22:28:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708032228.v73MSU4L070875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 3 Aug 2017 22:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322032 - in head/sys: amd64/include i386/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/include i386/include X-SVN-Commit-Revision: 322032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 22:28:32 -0000 Author: cem Date: Thu Aug 3 22:28:30 2017 New Revision: 322032 URL: https://svnweb.freebsd.org/changeset/base/322032 Log: x86: Tag some intrinsics with __pure2 Some C wrappers for x86 instructions do not touch global memory and only act on their arguments; they can be marked __pure2, aka __const__. Without this annotation, Clang 3.9.1 is not intelligent enough on its own to grok that these functions are __const__. Submitted by: Anton Rang Sponsored by: Dell EMC Isilon Modified: head/sys/amd64/include/cpufunc.h head/sys/i386/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Thu Aug 3 21:37:57 2017 (r322031) +++ head/sys/amd64/include/cpufunc.h Thu Aug 3 22:28:30 2017 (r322032) @@ -63,7 +63,7 @@ breakpoint(void) __asm __volatile("int $3"); } -static __inline u_int +static __inline __pure2 u_int bsfl(u_int mask) { u_int result; @@ -72,7 +72,7 @@ bsfl(u_int mask) return (result); } -static __inline u_long +static __inline __pure2 u_long bsfq(u_long mask) { u_long result; @@ -81,7 +81,7 @@ bsfq(u_long mask) return (result); } -static __inline u_int +static __inline __pure2 u_int bsrl(u_int mask) { u_int result; @@ -90,7 +90,7 @@ bsrl(u_int mask) return (result); } -static __inline u_long +static __inline __pure2 u_long bsrq(u_long mask) { u_long result; @@ -155,7 +155,7 @@ enable_intr(void) #define HAVE_INLINE_FFSL -static __inline int +static __inline __pure2 int ffsl(long mask) { return (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1); @@ -163,7 +163,7 @@ ffsl(long mask) #define HAVE_INLINE_FFSLL -static __inline int +static __inline __pure2 int ffsll(long long mask) { return (ffsl((long)mask)); @@ -171,7 +171,7 @@ ffsll(long long mask) #define HAVE_INLINE_FLS -static __inline int +static __inline __pure2 int fls(int mask) { return (mask == 0 ? mask : (int)bsrl((u_int)mask) + 1); @@ -179,7 +179,7 @@ fls(int mask) #define HAVE_INLINE_FLSL -static __inline int +static __inline __pure2 int flsl(long mask) { return (mask == 0 ? mask : (int)bsrq((u_long)mask) + 1); @@ -187,7 +187,7 @@ flsl(long mask) #define HAVE_INLINE_FLSLL -static __inline int +static __inline __pure2 int flsll(long long mask) { return (flsl((long)mask)); Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Thu Aug 3 21:37:57 2017 (r322031) +++ head/sys/i386/include/cpufunc.h Thu Aug 3 22:28:30 2017 (r322032) @@ -60,7 +60,7 @@ breakpoint(void) __asm __volatile("int $3"); } -static __inline u_int +static __inline __pure2 u_int bsfl(u_int mask) { u_int result; @@ -69,7 +69,7 @@ bsfl(u_int mask) return (result); } -static __inline u_int +static __inline __pure2 u_int bsrl(u_int mask) { u_int result; @@ -169,7 +169,7 @@ sfence(void) #define HAVE_INLINE_FFS -static __inline int +static __inline __pure2 int ffs(int mask) { /* @@ -183,7 +183,7 @@ ffs(int mask) #define HAVE_INLINE_FFSL -static __inline int +static __inline __pure2 int ffsl(long mask) { return (ffs((int)mask)); @@ -191,7 +191,7 @@ ffsl(long mask) #define HAVE_INLINE_FLS -static __inline int +static __inline __pure2 int fls(int mask) { return (mask == 0 ? mask : (int)bsrl((u_int)mask) + 1); @@ -199,7 +199,7 @@ fls(int mask) #define HAVE_INLINE_FLSL -static __inline int +static __inline __pure2 int flsl(long mask) { return (fls((int)mask));