On Fri, 14 Oct 2016 20:55:30 +0200 Dimitry Andric <dimi...@andric.com> wrote:
> On 14 Oct 2016, at 04:06, Ed Maste <ema...@freebsd.org> wrote:
>> On 14 October 2016 at 01:53, Bruce Evans <b...@optusnet.com.au> wrote:  
>>>> compiler-rt's complex division support routines contain calls to
>>>> compiler builtins such as `__builtin_scalbnl`.  Unfortunately Clang
>>>> turns these back into a call to `scalbnl`.  
>>> 
>>> gcc-4.2 has the same bug.  
>> 
>> Oh, interesting. Do you know off hand if it's resolved in later GCC?  
> 
> Not for x86, in any case (I think I talked about this with you on IRC
> before).  For example, using the latest gcc 7.0.0 20160911 on this
> program:
> 
> float f1(float x, int n)
> {
>       return __builtin_scalbnf(x, n);
> }
> 
> double f2(double x, int n)
> {
>       return __builtin_scalbn(x, n);
> }
> 
> long double f3(long double x, long n)
> {
>       return __builtin_scalbnl(x, n);
> }
> 
> gives this assembly:
> 
>       .p2align 4,,15
>       .globl  f1
>       .type   f1, @function
> f1:
> .LFB0:
>       .cfi_startproc
>       jmp     scalbnf
>       .cfi_endproc
> .LFE0:
>       .size   f1, .-f1
>       .p2align 4,,15
>       .globl  f2
>       .type   f2, @function
> f2:
> .LFB1:
>       .cfi_startproc
>       jmp     scalbn
>       .cfi_endproc
> .LFE1:
>       .size   f2, .-f2
>       .p2align 4,,15
>       .globl  f3
>       .type   f3, @function
> f3:
> .LFB2:
>       .cfi_startproc
>       jmp     scalbnl
>       .cfi_endproc
> .LFE2:
>       .size   f3, .-f3
> 
> E.g., it looks like the __builtin_scalbn functions were always a red
> herring. :-)

>From https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html:

GCC includes built-in versions of many of the functions in the standard C
library. These functions come in two forms: one whose names start with
the __builtin_ prefix, and the other without. Both forms have the same
type (including prototype), the same address (when their address is
taken), and the same meaning as the C library functions even if you
specify the -fno-builtin option see C Dialect Options). Many of these
functions are only optimized in certain cases; if they are not optimized
in a particular case, a call to the library function is emitted.
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to