This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH, i386]: Use missing gcc math builtins
- From: Uros Bizjak <uros dot bizjak at kss-loka dot si>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: Uros Bizjak <uros dot bizjak at kss-loka dot si>,libc-alpha at sources dot redhat dot com
- Date: Tue, 14 Jun 2005 07:38:47 +0200
- Subject: Re: [PATCH, i386]: Use missing gcc math builtins
- References: <email@example.com> <42AE2A70.firstname.lastname@example.org>
Quoting Ulrich Drepper <email@example.com>:
> > This patch enhances libc's mathinline.h header to use some missing
> > (mainly rounding builtins) that were added during 4.0 timeframe.
> But those builtins seem not to do much. Just look at
> #include <stdio.h>
> main (void)
> double x = 4.5;
> printf ("%g\n", __builtin_exp2l (x));
> return 0;
> The __builtin_exp2l call is not expanded inline, it's expanded to a call
> to exp2l. The definition in the libc header is complicated for a reason
> and I don't think gcc wants to hardcode that.
It is OK this way. These builtins will be expanded to inlines only when
-ffast-math is added to compile flags. Otherwise, it will fall-back to function
call. Almost all x87 math builtins (including (float)->(int) conversions) are
enabled only with -ffast-math in gcc.
> I haven't looked at the remainder of the patch. If there are some
> builtins which are indeed useful and there is a difference in the code
> generation, send a new patch.
If -ffast-math is specified, all these builtins will be expanded to their
inlines. This patch mainly gets #defines from mathinline.h out of the way, when
correct version of gcc is used (patch is based on the same approach as some
earlier Jakub Jelinek's patch in this area).