Received: (from major@localhost)
	by minnie.cs.adfa.oz.au (8.8.8/8.8.8) id TAA14844
	for pups-liszt; Fri, 8 May 1998 19:54:45 +1000 (EST)
Received: from freebie.lemis.com (freebie.lemis.com [139.130.136.133])
	by minnie.cs.adfa.oz.au (8.8.8/8.8.8) with ESMTP id TAA14839
	for <pups@minnie.cs.adfa.oz.au>; Fri, 8 May 1998 19:54:38 +1000 (EST)
Received: (from grog@localhost)
          by freebie.lemis.com (8.8.8/8.8.7) id TAA18750;
          Fri, 8 May 1998 19:46:16 +0930 (CST)
          (envelope-from grog)
Message-ID: <19980508194615.O12200@freebie.lemis.com>
Date: Fri, 8 May 1998 19:46:15 +0930
From: Greg Lehey <grog@lemis.com>
To: edgee@cyberpass.net
Cc: pups@minnie.cs.adfa.oz.au
Subject: Re: Floating Point-The Results Are In!
References: <199805070045.UAA04653@renoir.op.net>; <19980507110724.M396@freebie.lemis.com> <199805080414.AAA28438@renoir.op.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 0.91.1i
In-Reply-To: <199805080414.AAA28438@renoir.op.net>; from Ed G. on Fri, May 08, 1998 at 12:14:03AM -0400
WWW-Home-Page: http://www.lemis.com/~grog
Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia
Phone: +61-8-8388-8286
Fax: +61-8-8388-8725
Mobile: +61-41-739-7062
Sender: owner-pups@minnie.cs.adfa.oz.au
Precedence: bulk

On Fri,  8 May 1998 at  0:14:03 -0400, Ed G. wrote:
Content-Description: Mail message body
>> I'll believe this when you pinpoint the instructions.
>
> Your skepticism spurred me to examine a Unix utility in depth to see
> whether my results hold up.  They do.
>
> According to my count, tar uses 106 floating point operations.  Here
> are the first few.  The complete list, tar3.txt, is attached as
> well for your perusal. If you'd like to look at the complete
> disassembled code for tar, let me know.
>
> [root@oskar uv7]# ../dis/disuv7.pl < tar | grep ';17'
> file header: 410 37400 4254 27422 20270 0 0 1
> read 16128 bytes
> prog string is 16128 bytes
> 0:  SETD   ;170011
> 20532:  STCFD F0,(R1)   ;176011
> 20562:  STF F0,(R1)   ;174011
> 22406:  LDF F0,(R4)+   ;172424
> 22410:  STF F0,-(SP)   ;174046
> 22460:  LDF F0,(R4)+   ;172424
> 22462:  STF F0,-(SP)   ;174046
> 22620:  LDF F0,(R4)+   ;172424
> 22622:  STF F0,-(SP)   ;174046
> 24124:  LDF F0,4(R5)   ;172465 000004
> 24130:  STF F0,-(SP)   ;174046
> 26616:  LDF F0,#56200   ;172427 056200
>
> I chose tar as an example because it is an important utility and
> because it is a relatively heavy user of floating point (as guaged
> by the number of floating point ops contained in tar).

I don't know what the code above is intended to do, but it's not
floating point.  At the very best, it would indicate the use of the
floating point registers for straightforward data moves.  I stand by
my assertion that tar doesn't use floating point, neither in the
Seventh Edition nor elsewhere.

For the fun of it, I took the source of tar from the Seventh Edition
(/usr/src/cmd/tar/tar.c) and compiled it on 2.11BSD.  I had some minor
compilation problems due to different directory structures, which I
solved by #ifdefing out the following code:

#if 0
                        for (j=0; j < DIRSIZ; j++)
                                *cp2++ = dbuf.d_name[j];
                        *cp2 = '\0';
                        close(infile);
                        putfile(buf, cp);
                        infile = open(".", 0);
                        i++;
                        lseek(infile, (long) (sizeof(dbuf) * i), 0);
#endif

I think we can agree that they don't contain FP code.  Here are some
results:

[23] root--> cc -n -s -O tar.c -S
[24] root--> grep -i ldf tar.s
[25] root--> grep -i mul tar.s


> The following routines in 7th Edition tar appear to use floating
> point:
>
>> _filbuf
>> _innum
>> atof
>> cvt
>> ecvt
>> fcvt
>> gcvt
>> isatty
>> main
>> mktemp

atof, cvt, ecvt, fcvt and gcvt are conversion routines which use
floating point, so I can agree that they would contain FP code which,
however, would not be used.  isatty is a library routine which is
simple enough to quote:

/*
 * Returns 1 iff file is a tty
 */

#include <sgtty.h>

isatty(f)
{
        struct sgttyb ttyb;

        if (gtty(f, &ttyb) < 0)
                return(0);
        return(1);
}

Evidently there's no FP code there.

It's fun to go looking for things like this.  But never trust
anything, especially not your own judgement, until you have a couple
of different ways to prove it.  You have the sources there; go ahead
and check them out.

Greg
--
See complete headers for address and phone numbers
finger grog@lemis.com for PGP public key

