Fortran 300 times faster than C for computing cosine
Joerg Schilling
joerg%berthold.UUCP%TUB.BITNET at mitvma.mit.edu
Sat May 6 11:01:54 AEST 1989
The sun C compiles does convert calls to the *external* c function sin() ...
into 68881 routines if you tell him to use the inline expander.
Try the folling c program (t.c):
extern double sin();
double t()
{
return sin(123.0);
}
use the command :
joerg > cc -v -O2 -f68881 -S /usr/lib/f68881/libm.il t.c
..
Verbose output removed.
joerg > cat t.s
..
Several lines removed.
.text
.globl _t
_t:
|#PROLOGUE# 0
link a6,#-8
|#PROLOGUE# 1
movl L2000000+4,sp at -
movl L2000000,sp at -
fsind sp@,fp0
fmoved fp0,sp@
movl sp at +,a6@(-8)
movl sp at +,a6@(-4)
movl a6@(-8),d0
movl a6@(-4),d1
|#PROLOGUE# 2
unlk a6
|#PROLOGUE# 3
rts
L2000000:
.long 1079951360,0
joerg >
As you see the call to the *external* function is converted into the
correct mc68881 code. See the manual of inline(1) for more information.
J. Schilling
H. Berthold AG
Teltowkanalstr. 1-4
D 1000 Berlin 46
+49 30 7795 - 400
joerg at berthold.de
.. tub!berthold!joerg
.. unido!berthold!joerg
More information about the Comp.sys.sun
mailing list