[PATCH, libgcc]: Use type-generic fpclassify builtins in libgcc2.c
Jeff Law
law@redhat.com
Wed Oct 3 20:42:00 GMT 2018
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
More information about the Gcc-patches
mailing list