*BSD News Article 2742


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!spool.mu.edu!sgiblab!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!destroyer!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Newsgroups: comp.unix.bsd
Subject: Re: 386BSD-0.1/BRLCAD4.0 benchmark -- poor floa
Message-ID: <1992Jul29.222708.4315@klaava.Helsinki.FI>
Date: 29 Jul 92 22:27:08 GMT
Article-I.D.: klaava.1992Jul29.222708.4315
References: <l7ctu0INN880@neuro.usc.edu> <1992Jul29.152914.2508@nrao.edu>
Organization: University of Helsinki
Lines: 31

In article <1992Jul29.152914.2508@nrao.edu> cflatter@nrao.edu writes:
>In article l7ctu0INN880@neuro.usc.edu, merlin@neuro.usc.edu (merlin) writes:
>>
>>Does gcc 2.2 actually use 80387 inline code for transcedental functions?
>
>No. I just looked :-(.  (Unless it is very well hidden).

gcc-2.2.2 only uses the basic math + fsqrt (fsqrt is new to gcc-2.x). 
The basic math is handled pretty well, though: much better than with
earlier versions.  gcc-2 knows about the fpu stack, resulting in fpu
code that looks almost hand-optimized (at least sometimes).  gcc-1.40
isn't very good at handling the 387 stack (it seems to use mostly
ready-made templates). 

>It could probably be made to though.  There appears to be some support for
>inlining transcendental functions for the Moto 68881.

I don't think inlining is as easy on the 387 as it's on a 68881: the 387
transcendental functions have enough special cases (argument limitations
etc) that it's probably easier to do it in a dedicated function.  But
those functions should certainly use the 387 instructions instead of
using series arithmetic or whatever portable C code the current 386bsd
libraries seem to use. 

The linux libraries might be useful: linux has two different math
libraries, one for soft-float (ie using only the normal arithmetic
functions that are emulated), and one for hard-float.  With shared
libraries (under linux), the same binary can use either, but under
386bsd you'd have to decide at link-time which to use. 

		Linus