[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (elisp)Numbers

From: Eli Zaretskii
Subject: Re: (elisp)Numbers
Date: 26 Oct 2003 08:04:31 +0200

> From: Richard Stallman <address@hidden>
> Date: Sat, 25 Oct 2003 18:26:38 -0400
>     Here's the code I see with "gcc -E -O2" on fencepost (I reformatted it
>     for better readability):
>       extern __inline double sqrt ( double __x) 
>       { 
>         register double __result;
>         __asm __volatile__ ( "fsqrt" : "=t" (__result) : "0" (__x) );
>          return __result; 
>       }
> 1. where does this code come from?  which file in which package?

This is part of cpp's output when I run on floatfns.c the same
command as when it is compiled into floatfns.o, but with -c replaced
with -E.  For the build on fencepost, this is the command I ran:

  gcc -E -D_BSD_SOURCE -Demacs -DHAVE_CONFIG_H -I. -I/home/e/eliz/emacs/src 
-D_BSD_SOURCE -O2 floatfns.c | less -ci

If you omit -O2, the inline expansion of `sqrt' doesn't appear in the
output, so the library function is called.

The expansion itself seems to come from
/usr/include/bits/mathinline.h, which is part of glibc, since
immediately before the above snippet, I see this line:

   # 438 "/usr/include/bits/mathinline.h" 3

mathinlines.h has this near line 438:

   __inline_mathopNP (sqrt, "fsqrt")

which, after a series of macro expansions, eventually expands into
the above inline definition of `sqrt'.

Similar things happen with other math functions.  It sounds like
under -O2 no math function ever sets errno.

> 2. i see that my CFLAGS setting to turn off inlining got lost
> when i reran configure.  so i put that back in and recompiled,
> and it went away.

What went away?  You mean that Emacs did throw a domain error when
floatfns.c was compiled without optimizations?

Anyway, we do want floatfns.c to be compiled with optimization and
still DTRT, right?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]