Newsgroups: comp.sys.next
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!news
From: burton@udun.endor.cs.psu.edu (Brian T Burton)
Subject: Re: Fxxx traps on 68040
Message-ID: <b7aG4l#a1@cs.psu.edu>
Followup-To: bennett@mp.cs.niu.edu (Scott Bennett)
Sender: news@cs.psu.edu (Usenet)
Nntp-Posting-Host: udun.endor.cs.psu.edu
Organization: Penn State Computer Science
Date: Thu, 28 Mar 91 14:11:59 GMT
Lines: 57

>>The problem isn't the compiler at all, it's the subroutines in
>>libm.a.  (The compiler doesn't generate inline instructions for fsin
>>etc unless the macro INLINE_MATH is explicitly defined).
>
>     Well, I don't know about 2.0, but 1.0a's math.h generates the
>in-line transcendentals.

Actually, if you look at the code generated by cc without the
-DINLINE_MATH option set, you'll see that it generates function calls.

>>
>>libm.a contains stub routines that contain the fxxx instructions.
>
>     Not unless 2.0 is screwed up.  libm.a is supposed to contain
>the BSD math library.  On a 68030/68882, libm.a takes about three
>times as long to calculate transcendentals as the in-line Fxxx 
>instructions do.

Actually, this is precisely what libm.a on 2.0 contains:

	~ : 102 >otool -tv '/usr/lib/libm.a(trig.o)'
	/usr/lib/libm.a(trig.o):
	Text segment
	_sin:
	00000000        linkw   a6,#0x0
	00000004        fmoved  a6@(0x8:w),fp0
	0000000a        fsinx   fp0
	0000000e        fmoved  fp0,sp@-
	00000012        movel   sp@+,d0
	00000014        movel   sp@+,d1
	00000016        unlk    a6
	00000018        rts
	_cos:
	0000001a        linkw   a6,#0x0
	0000001e        fmoved  a6@(0x8:w),fp0
	00000024        fcosx   fp0
	00000028        fmoved  fp0,sp@-
	0000002c        movel   sp@+,d0
	0000002e        movel   sp@+,d1
	00000030        unlk    a6
	00000032        rts
	_tan:
	00000034        linkw   a6,#0x0
	00000038        fmoved  a6@(0x8:w),fp0
	0000003e        ftanx   fp0
	00000042        fmoved  fp0,sp@-
	00000046        movel   sp@+,d0
	00000048        movel   sp@+,d1
	0000004a        unlk    a6
	0000004c        rts
	0000004e        nop
	
As you can see, these are not function calls, but stub routines which
use the fxxx instructions.  So I guess things are 'screwed up'.

++Brian

