Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2016 21:53:11 +0200
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        Dimitry Andric <dimitry@andric.com>
Cc:        Ed Maste <emaste@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r307231 - head/lib/libgcc_s
Message-ID:  <20161014215311.6b723fab@kalimero.tijl.coosemans.org>
In-Reply-To: <D2B021E3-62D3-4CC6-AE6C-02D683AD7699@andric.com>
References:  <201610131918.u9DJI0bX085695@repo.freebsd.org> <20161014113603.F1039@besplex.bde.org> <CAPyFy2ApcwgdScnX%2BaK%2BKBR5_TVkeB-Kdc6Y1HUO98uhw4fpfA@mail.gmail.com> <D2B021E3-62D3-4CC6-AE6C-02D683AD7699@andric.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 14 Oct 2016 20:55:30 +0200 Dimitry Andric <dimitry@andric.com> wrot=
e:
> On 14 Oct 2016, at 04:06, Ed Maste <emaste@freebsd.org> wrote:
>> On 14 October 2016 at 01:53, Bruce Evans <brde@optusnet.com.au> wrote: =
=20
>>>> 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`. =20
>>>=20
>>> gcc-4.2 has the same bug. =20
>>=20
>> Oh, interesting. Do you know off hand if it's resolved in later GCC? =20
>=20
> 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:
>=20
> float f1(float x, int n)
> {
> 	return __builtin_scalbnf(x, n);
> }
>=20
> double f2(double x, int n)
> {
> 	return __builtin_scalbn(x, n);
> }
>=20
> long double f3(long double x, long n)
> {
> 	return __builtin_scalbnl(x, n);
> }
>=20
> gives this assembly:
>=20
> 	.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
>=20
> E.g., it looks like the __builtin_scalbn functions were always a red
> herring. :-)

=46rom 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161014215311.6b723fab>