From owner-cvs-src@FreeBSD.ORG Sat Apr 9 01:51:28 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B41C16A4CE; Sat, 9 Apr 2005 01:51:28 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F71D43D31; Sat, 9 Apr 2005 01:51:27 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.3/8.13.1) with ESMTP id j391p1le040627; Fri, 8 Apr 2005 21:51:01 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.MIT.EDU (8.13.3/8.13.1/Submit) id j391p1jK040626; Fri, 8 Apr 2005 21:51:01 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Fri, 8 Apr 2005 21:51:01 -0400 From: David Schultz To: Alan Cox Message-ID: <20050409015101.GA40551@VARK.MIT.EDU> Mail-Followup-To: Alan Cox , Alan Cox , src-committers@FreeBSD.ORG, cvs-src@FreeBSD.ORG, cvs-all@FreeBSD.ORG References: <200504080515.j385FtbX016388@repoman.freebsd.org> <20050408061426.GH20275@cs.rice.edu> <20050408160358.GA37897@VARK.MIT.EDU> <20050408164716.GI20275@cs.rice.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050408164716.GI20275@cs.rice.edu> cc: Alan Cox cc: cvs-src@FreeBSD.ORG cc: src-committers@FreeBSD.ORG cc: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/amd64/string Makefile.inc bcmp.S memcmp.S X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2005 01:51:28 -0000 On Fri, Apr 08, 2005, Alan Cox wrote: > On Fri, Apr 08, 2005 at 12:03:58PM -0400, David Schultz wrote: > > On Fri, Apr 08, 2005, Alan Cox wrote: > > > On Fri, Apr 08, 2005 at 05:15:55AM +0000, Alan Cox wrote: > > > > alc 2005-04-08 05:15:55 UTC > > > > > > > > FreeBSD src repository > > > > > > > > Modified files: > > > > lib/libc/amd64/string Makefile.inc > > > > Added files: > > > > lib/libc/amd64/string bcmp.S memcmp.S > > > > Log: > > > > Add machine-specific, optimized implementations of bcmp and memcmp. > > > > > > > > PR: 73111 > > > > Submitted by: Ville-Pertti Keinonen (taken from NetBSD) > > > > MFC after: 3 weeks > > > > > > > > Revision Changes Path > > > > 1.2 +1 -1 src/lib/libc/amd64/string/Makefile.inc > > > > 1.1 +25 -0 src/lib/libc/amd64/string/bcmp.S (new) > > > > 1.1 +41 -0 src/lib/libc/amd64/string/memcmp.S (new) > > > > > > It is worth noting that by default the current version of gcc > > > automatically inlines its own implementation of these functions. That > > > implementation is slower than this new libc implementation for strings > > > of non-trivial length. > > > > IIRC, gcc only inlines these in special cases, e.g. if it knows > > the length or contents of one of the strings. But this may have > > changed. > > Yes, however, for bcmp and memcmp the length is given as a parameter > and thus is always known. The surprising fact is that the length does > not have to be a constant for inlining to occur. Arguably gcc's > heuristic for inlining these functions should require the length to be > a small constant. Ah, right, I was thinking of strcmp(). Perhaps this should be filed as a gcc bug.