From owner-freebsd-hackers Sun Apr 5 15:10:55 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA26592 for freebsd-hackers-outgoing; Sun, 5 Apr 1998 15:10:55 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from gatekeeper.alcatel.com.au (gatekeeper.alcatel.com.au [203.17.66.1]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA26535 for ; Sun, 5 Apr 1998 15:10:35 -0700 (PDT) (envelope-from Peter.Jeremy@alcatel.com.au) Received: from mfg1.cim.alcatel.com.au ([139.188.23.1]) by gatekeeper.alcatel.com.au (PMDF V5.1-7 #U2695) with ESMTP id <01IVJIY6UXCG00005D@gatekeeper.alcatel.com.au> for hackers@FreeBSD.ORG; Mon, 6 Apr 1998 08:09:58 +1000 Received: from cbd.alcatel.com.au by cim.alcatel.com.au (PMDF V5.1-10 #U2695) with ESMTP id <01IVJHYUQTW0BTSFN9@cim.alcatel.com.au> for hackers@FreeBSD.ORG; Mon, 06 Apr 1998 07:42:15 +1000 Received: from gsms01.alcatel.com.au by cbd.alcatel.com.au (PMDF V5.1-7 #U2695) with ESMTP id <01IVJHYRLMR4AZTRGG@cbd.alcatel.com.au> for hackers@FreeBSD.ORG; Mon, 06 Apr 1998 07:42:10 +1100 Received: (from jeremyp@localhost) by gsms01.alcatel.com.au (8.8.8/8.7.3) id HAA03666 for hackers@FreeBSD.ORG; Mon, 06 Apr 1998 07:42:07 +1000 (EST) Date: Mon, 06 Apr 1998 07:42:07 +1000 (EST) From: Peter Jeremy Subject: H/W specific optimisations (was Re: bcopy implementation) To: hackers@FreeBSD.ORG Message-id: <199804052142.HAA03666@gsms01.alcatel.com.au> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 3 Apr 1998 16:20:08 +0200 (CEST), Mikael Karpberg wrote: >According to Dave Marquardt: >> > of not implementing this method in libc? >> >> Well, you said it yourself. "On the assumption, that the system has >> pentium processor...." Well, we can't assume that, since FreeBSD runs >> on 386s and up. > >Well, if you want everything to go faster, you optimize for the hardware >you're actually gonna run on. This is a fairly useful idea, although the suggested implementation: >ifdefs so that you would add -DOPTIMIZE_FOR_PENTIUM to CFLAGS in make.conf >and then make world. is still processor-specific: You need to do a `make world' for each different processor type. I'd like to suggest something along the lines that Sun does in Solaris 2.x: A directory tree /usr/platform contains all platform specific code, including (optional) platform-specific shared libraries which override the generic default library code. At load-time, the appropriate library is loaded (if it exists) by ld.so. As an example, on sun4m machines (eg SPARCstation 5,10,20), there's no platform specific library. On the sun4u (UltraSPARC) machines, the library includes __div64(), __mul64(), __rem64(), __udiv64(), __umul64(), __urem64(), memcmp(), memcpy(), memmove(), memset(). This approach has the advantage that only the platform-specific functions are in the library, so it's fairly small. Obviously, this solution only works for shared executables, and isn't quite as good as a compiling for a specific processor (because you can't in-line what become trivial functions - like the 64-bit math functions on the UltraSPARC). The nicety about this approach is that there's no run-time overhead (at least no more than for any other shared-library call). Peter -- Peter Jeremy (VK2PJ) peter.jeremy@alcatel.com.au Alcatel Australia Limited 41 Mandible St Phone: +61 2 9690 5019 ALEXANDRIA NSW 2015 Fax: +61 2 9690 5247 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message