From owner-freebsd-hackers Sun Feb 12 11:14:14 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id LAA27973 for hackers-outgoing; Sun, 12 Feb 1995 11:14:14 -0800 Received: from mail.rwth-aachen.de (mail.RWTH-Aachen.DE [137.226.144.9]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id LAA27966 for ; Sun, 12 Feb 1995 11:14:11 -0800 Received: from gilberto.physik.rwth-aachen.de by mail.rwth-aachen.de (PMDF V4.3-10 #7297) id <01HMZ3FETSA8000DUO@mail.rwth-aachen.de>; Sun, 12 Feb 1995 20:15:05 +0100 Received: by gilberto.physik.rwth-aachen.de (UAA04742); Sun, 12 Feb 1995 20:21:18 +0100 Date: Sun, 12 Feb 1995 20:21:18 +0100 From: "Christoph P. Kukulies" Subject: Re: fp inline code To: freebsd-hackers@freefall.cdrom.com Message-id: <199502121921.UAA04742@gilberto.physik.rwth-aachen.de> Content-transfer-encoding: 7BIT Sender: hackers-owner@FreeBSD.org Precedence: bulk > > I want to have gcc produce inline sin, cos, log etc. functions as > > 387 instructions. Is this possible? I always thought -ffast-math > > would do that but it still generates call _sin etc. > > You have to use -ffast-math -mfancy-math-387 under FreeBSD to get > inlined sin, cos and sqrt. See gcc.info*; this is not documented > in the manpage. Other 387 functions are not handled by gcc. > > Bruce I tried the following: Script started on Sun Feb 12 20:13:43 1995 blues> cat d.c main() { int i; double sin(),sqrt(); double a = sin(3.14); for (i = 0; i < 1000000; i++) a = sin(sqrt(a) + 1.0); printf("a=%lf\n", a); } blues> blues> gcc -S -ffast-math -mfancy-math-387 d. blues> cat d. .file "d.c" gcc2_compiled.: ___gnu_compiled_c: .text LC0: .ascii "a=%lf\12\0" .align 2 .globl _main .type _main,@function _main: pushl %ebp movl %esp,%ebp subl $12,%esp call ___main pushl $1074339512 pushl $1374389535 call _sin addl $8,%esp fstpl -12(%ebp) movl $0,-4(%ebp) L2: cmpl $999999,-4(%ebp) jle L5 jmp L3 .align 2,0x90 L5: pushl -8(%ebp) pushl -12(%ebp) call _sqrt addl $8,%esp fld1 faddp %st,%st(1) subl $8,%esp fstpl (%esp) call _sin addl $8,%esp fstpl -12(%ebp) L4: incl -4(%ebp) jmp L2 .align 2,0x90 L3: pushl -8(%ebp) pushl -12(%ebp) pushl $LC0 call _printf addl $12,%esp L1: leave ret Lfe1: .size _main,Lfe1-_main blues> Script done on Sun Feb 12 20:14:28 1995 I don't see sin, sqrt being inlined by fpu instructions. Am I missing something? --Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de FreeBSD blues 2.1.0-Development FreeBSD 2.1.0-Development #0: Tue Feb 7 09:56:53 1995 kuku@blues:/sys/compile/BLUES i386