This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc handling of the sin, cos functions
On 19 Nov 1999 01:00:22 -0200, you wrote:
>On Nov 18, 1999, Jim Carrig <jcarrig@bellatlantic.net> wrote:
>
>> I get the feeling that the gcc C compiler (math library) for Intel
>> platforms does not take advantage of the floating point unit in
>> calculating sin, cos, exp etc. Is this correct?
>
>I believe it is, as this is a C library issue. On GNU/Linux, this is
>handled by the GNU C Library, which is a separate project: the math
>functions are defined as inline assembly code, making use of the
>special instructions. But gcc might be taught to expand these
>particular functions by itself, just like it currently does with some
>string and memory functions.
Isn't it what -ffast-math does? Check it out:
.file "00.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.string "%f\n"
.text
.align 4
.globl main
.type main,@function
main:
fldz
pushl %ebp
movl %esp,%ebp
subl $8,%esp
addl $-4,%esp
fsin
subl $8,%esp
fstpl (%esp)
pushl $.LC0
call printf
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.95.1 19990816 (release)"
>Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
Dima