This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libgcc]: Use type-generic fpclassify builtins in libgcc2.c
- From: Jeff Law <law at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 3 Oct 2018 14:20:24 -0600
- Subject: Re: [PATCH, libgcc]: Use type-generic fpclassify builtins in libgcc2.c
- References: <CAFULd4Yg3k2h+2ke0=ypGVy16OobD_2Uvft6fFz7+jffwq_c4w@mail.gmail.com> <d9cc5ff9-b2bc-ae02-4654-47083dfdec47@redhat.com> <CAFULd4ZNtjrFOrzBGqfMUTPDb=gMZvXVrBHsO6TvhZCMkpR=nw@mail.gmail.com>
On 10/3/18 12:48 PM, Uros Bizjak wrote:
> On Wed, Oct 3, 2018 at 6:53 PM Jeff Law <law@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 <ubizjak@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).
Thanks for explaining things. The patch is OK for the trunk.
Jeff