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


> 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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to