From nobody@FreeBSD.org  Mon Oct 25 11:53:25 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5C51516A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Oct 2004 11:53:25 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 408F643D48
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Oct 2004 11:53:25 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i9PBrPnU026370
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Oct 2004 11:53:25 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i9PBrPUf026369;
	Mon, 25 Oct 2004 11:53:25 GMT
	(envelope-from nobody)
Message-Id: <200410251153.i9PBrPUf026369@www.freebsd.org>
Date: Mon, 25 Oct 2004 11:53:25 GMT
From: Ville-Pertti Keinonen <will@iki.fi>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Optimized libc string functions missing for amd64
X-Send-Pr-Version: www-2.3

>Number:         73111
>Category:       amd64
>Synopsis:       Optimized libc string functions missing for amd64
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 25 12:00:56 GMT 2004
>Closed-Date:    Sun Jun 19 12:00:57 GMT 2005
>Last-Modified:  Sun Jun 19 12:00:57 GMT 2005
>Originator:     Ville-Pertti Keinonen
>Release:        6.0-current
>Organization:
>Environment:
>Description:
Using optimized assembly language versions of string functions on amd64 (this is already done on other architectures) would probably be a good idea.

Functions adapted from NetBSD (which can be extracted into /usr/src for inclusion in a buildworld) are available at the following URL:
http://will.iki.fi/patches/libc-amd64-string.tar.gz

I mentioned the issue on -current, but this didn't result in any discussion.

The NetBSD functions may or may not all be desirable in their current form; some of the functions have extensive unrolling and may produce a performance penalty for short strings (but a huge advantage for longer ones).

>How-To-Repeat:

>Fix:
      
>Release-Note:
>Audit-Trail:

From: John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To: Ville-Pertti Keinonen <will@iki.fi>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: amd64/73111: Optimized libc string functions missing for amd64
Date: Mon, 25 Oct 2004 10:03:20 -0700

 Ville-Pertti Keinonen wrote this message on Mon, Oct 25, 2004 at 11:53 +0000:
 > >Description:
 > Using optimized assembly language versions of string functions on amd64 (this is already done on other architectures) would probably be a good idea.
 > 
 > Functions adapted from NetBSD (which can be extracted into /usr/src for inclusion in a buildworld) are available at the following URL:
 > http://will.iki.fi/patches/libc-amd64-string.tar.gz
 > 
 > I mentioned the issue on -current, but this didn't result in any discussion.
 > 
 > The NetBSD functions may or may not all be desirable in their current form; some of the functions have extensive unrolling and may produce a performance penalty for short strings (but a huge advantage for longer ones).
 
 Have you run some benchmarks to validate that the assembly optimized
 code is faster than the c generated?  if you need help analyzing the
 benchmark numbers, look at ministat in src/tools/tools/ministat...
 
 -- 
   John-Mark Gurney				Voice: +1 415 225 5579
 
      "All that I will do, has been done, All that I have, has not."
Responsible-Changed-From-To: freebsd-amd64->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Mon Oct 25 18:39:12 GMT 2004 
Responsible-Changed-Why:  
I've got some input from AMD on these. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73111 

From: Ville-Pertti Keinonen <will@iki.fi>
To: John-Mark Gurney <gurney_j@resnet.uoregon.edu>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: amd64/73111: Optimized libc string functions missing for amd64
Date: Tue, 26 Oct 2004 11:02:03 +0300

 John-Mark Gurney wrote:
 
 >Have you run some benchmarks to validate that the assembly optimized
 >code is faster than the c generated?  if you need help analyzing the
 >benchmark numbers, look at ministat in src/tools/tools/ministat...
 >  
 >
 Yes.  There is little enough variation to make statistical analysis 
 pretty much unnecessary.  All of the functions are faster on strings 
  >=64 bytes in length (with aligned buffers, but that's fairly typical 
 in real-world use).  For large enough strings, all of the functions are 
 at least 5 times as fast, and at best over 10 times as fast.
 
 The C functions are pretty bad, especially the block copy/set functions 
 (they're using , at best, int-sized -- 32-bit -- operations).
 
 A simplistic test I used (including results) can be found at 
 http://will.iki.fi/misc/strtest.tar.gz
 
State-Changed-From-To: open->closed 
State-Changed-By: matteo 
State-Changed-When: Sun Jun 19 11:59:00 GMT 2005 
State-Changed-Why:  
Fixed and MFCed.  
See: 
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/amd64/string/memcmp.S 
http://lists.freebsd.org/mailman/htdig/cvs-src/2005-April/044356.html 


http://www.freebsd.org/cgi/query-pr.cgi?pr=73111 
>Unformatted:
