From owner-freebsd-hackers Fri Jun 21 10:36:26 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id KAA29073 for hackers-outgoing; Fri, 21 Jun 1996 10:36:26 -0700 (PDT) Received: from Campino.Informatik.RWTH-Aachen.DE (campino.Informatik.RWTH-Aachen.DE [137.226.225.2]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id KAA29051 for ; Fri, 21 Jun 1996 10:36:18 -0700 (PDT) Received: from gilberto.physik.rwth-aachen.de (gilberto.physik.rwth-aachen.de [137.226.31.2]) by Campino.Informatik.RWTH-Aachen.DE (RBI-Z-5/8.6.12) with ESMTP id TAA22007; Fri, 21 Jun 1996 19:28:52 +0200 Received: (from kuku@localhost) by gilberto.physik.rwth-aachen.de (8.6.11/8.6.9) id TAA21575; Fri, 21 Jun 1996 19:41:20 +0200 From: "Christoph P. Kukulies" Message-Id: <199606211741.TAA21575@gilberto.physik.rwth-aachen.de> Subject: Re: TARGET_NO_FANCY_MATH_387 To: bde@zeta.org.au (Bruce Evans) Date: Fri, 21 Jun 1996 19:41:19 +0200 (MET DST) Cc: freebsd-hackers@FreeBSD.ORG, mrm@MARMOT.Mole.ORG In-Reply-To: <199605311508.BAA09743@godzilla.zeta.org.au> from Bruce Evans at "Jun 1, 96 01:08:37 am" Reply-To: Christoph Kukulies X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > >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 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