On Wed, Oct 3, 2018 at 6:53 PM Jeff Law <l...@redhat.com> wrote:
>
> On 10/2/18 9:41 AM, Uros Bizjak wrote:
> > Nowadays, we have these type-generic builtins always available.
> >
> > 2018-10-02  Uros Bizjak  <ubiz...@gmail.com>
> >
> >     * libgcc2.c (isnan): Use __builtin_isnan.
> >     (isfinite): Use __builtin_isfinite.
> >     (isinf): Use __builtin_isinf.
> >
> > Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> >
> > OK for mainline?
> Presumably the justification is that we default to C99 these days and
> thus the compiler handles these all internally without calling out to
> the library?  But what if the user explicitly asks for C89 rather than
> C99 or newer?

These defines are only used to build complex mul and div functions of
libgcc library. The library is built with its default flags. Builtins
are -std= agnostic, as shown in the following example:

--cut here--
int
test (double x)
{
  return __builtin_isinf (x);
}
--cut here--

gcc -O2 -std=c89 results in a compare insn:

test:
        andpd   .LC0(%rip), %xmm0
        xorl    %eax, %eax
        ucomisd .LC1(%rip), %xmm0
        seta    %al
        ret

(BTW: using isinf would depend on -std= flag, resulting in a call when
-std=c89 is used).

Uros.

Reply via email to