Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2016 20:55:30 +0200
From:      Dimitry Andric <dimitry@andric.com>
To:        Ed Maste <emaste@freebsd.org>
Cc:        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:  <D2B021E3-62D3-4CC6-AE6C-02D683AD7699@andric.com>
In-Reply-To: <CAPyFy2ApcwgdScnX%2BaK%2BKBR5_TVkeB-Kdc6Y1HUO98uhw4fpfA@mail.gmail.com>
References:  <201610131918.u9DJI0bX085695@repo.freebsd.org> <20161014113603.F1039@besplex.bde.org> <CAPyFy2ApcwgdScnX%2BaK%2BKBR5_TVkeB-Kdc6Y1HUO98uhw4fpfA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_39A3A199-5ACE-4C30-A9A6-089782D8B7E8
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 14 Oct 2016, at 04:06, Ed Maste <emaste@freebsd.org> wrote:
> 
> Hi Bruce, thank you for the detailed response.
> 
> On 14 October 2016 at 01:53, Bruce Evans <brde@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. :-)


> It seems particularly unfortunate for the compiler to report (by
> whatever mechanism) that a builtin exists, and then just turn that
> builtin into a library call.

Yes, at best this is misleading.

-Dimitry


--Apple-Mail=_39A3A199-5ACE-4C30-A9A6-089782D8B7E8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.30

iEYEARECAAYFAlgBKicACgkQsF6jCi4glqO+cwCaAwubamEu/RR+gK0kEkc0QOvV
FfAAoNDhm2dpPWMOsbf3PlgPo6OIb48c
=L87B
-----END PGP SIGNATURE-----

--Apple-Mail=_39A3A199-5ACE-4C30-A9A6-089782D8B7E8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D2B021E3-62D3-4CC6-AE6C-02D683AD7699>