Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!uw-june!entropy!dataio!bright From: bright@dataio.UUCP Newsgroups: comp.arch,comp.lang.c Subject: Re: String Handling -- Incompetence of run-time libraries Message-ID: <1281@dataio.Data-IO.COM> Date: Tue, 31-Mar-87 13:38:34 EST Article-I.D.: dataio.1281 Posted: Tue Mar 31 13:38:34 1987 Date-Received: Thu, 2-Apr-87 03:28:52 EST References: <15292@amdcad.UUCP> <978@ames.UUCP> <15694@sun.uucp> Reply-To: bright@dataio.UUCP (Walter Bright) Organization: Data I/O - FutureNet Corp., Redmond, WA Lines: 19 Keywords: instruction set architectures, strcpy Xref: utgpu comp.arch:727 comp.lang.c:1401 In article <5@wb1.cs.cmu.edu] avie@wb1.cs.cmu.edu (Avadis Tevanian) writes: ] In article <1531@husc6.UUCP] reiter@harvard.UUCP (Ehud Reiter) writes: ]] As a brief addition to my previous posting, when I used my own strcpy and strcmp ]] routines, the Dhrystone rating of my microVAX II (cc -O, 4.3BSD) jumped from ]] 1000 (library strcpy, strcmp) to 1400 (my strcpy, strcmp). ] You've got to be careful when you run benchmarks. If you are indeed running ] 4.3, then you are most likely using the 4.3 libc, which has been carefully ] optimized to use the fancy VAX instructions for the string routines. ] Unfortunately, some of these instructions are not implemented by the ] MicroVAX-II hardware. As it turns out, what is happening is that your tests ] (including Dhrystone) are causing kernel traps to emulate those ] instructions! The fix, of course, is: o Have the startup module determine what version of the CPU is running and set a global. o Have the string functions use different instruction sequences, depending on which CPU is being used. This is similar to how the 8087 is used on the PC.