Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 1996 19:41:19 +0200 (MET DST)
From:      "Christoph P. Kukulies" <kuku@gilberto.physik.rwth-aachen.de>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        freebsd-hackers@FreeBSD.ORG, mrm@MARMOT.Mole.ORG
Subject:   Re: TARGET_NO_FANCY_MATH_387
Message-ID:  <199606211741.TAA21575@gilberto.physik.rwth-aachen.de>
In-Reply-To: <199605311508.BAA09743@godzilla.zeta.org.au> from Bruce Evans at "Jun 1, 96 01:08:37 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> >Might it be a good thing now to change the default in gcc to enable
> >FP sin, cos and sqrt.
> 
> It would only give the inline sqrt.  The inline sin and cos are disabled
> in the FSF version of gcc-2.6.3 for other reasons.  At least the i386
> versions of them were broken.  You can use -mfancy-math-387 to get the
> inline sqrt and -ffast-math to get the inline sin and cos together with
> other fast and broken "math", or you can use inline assembler to get
> inline math functions exactly where you want, or you can use the i387
> version of libm to get non-inline hardware math functions in more cases.


Could you give an example showing that 

-ffancy-math-386 and -ffast-math

have an effect? I tried with a small example and I'm always getting
calls instead of fpu-inline statements. (gcc-2.6.3)

#include <math.h>
main()
{
    double d=2500.;
    printf("%lf\n",sqrt(sin(d)));
}

gcc  -ffast-math -m486 -mfancy-math-387 -S p.c


___gnu_compiled_c:
.text
LC0:
        .ascii "%lf\12\0"
        .align 4
.globl _main
        .type    _main,@function
_main:
        pushl %ebp
        movl %esp,%ebp
        subl $8,%esp
        call ___main
        movl $0,-8(%ebp)
        movl $1084459008,-4(%ebp)
        pushl -4(%ebp)
        pushl -8(%ebp)
        call _sin
        addl $8,%esp
        subl $8,%esp
        fstpl (%esp)
        call _sqrt

> >for those of us with trusty '386/16's. Those still dependent upon
> >FP simulation could use -mno-fancy-math-387...
> 
> The price of an i386 sqrt() emulation (in milliPentiums :-) has gone
> up.  Those dependent on FP emulation would probably have difficulty
> bootstrapping to use it.  At least the following utilities use sqrt(),
> so they might fail when their inline sqrt() doesn't work: as, awk, bc,
> cc1, cc1plus, dc, gdb, groff (parts), perl.
> 
> >and document
> >-mfancy-math-387, -mno-fancy-math-387 in the man page for cc? ;-)
> 
> They have been documented for 5 months in -current, and the changes were
> merged into -stable a couple of days ago.
> 
> Bruce
> 

--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606211741.TAA21575>