This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Cleanup FAST_MATH misc functions from sysdeps/x86/fpu/bits/mathinline.h


Hello!

Attached patch cleans up FAST_MATH misc functions from
sysdeps/x86/fpu/bits/mathinline.h. The patch uses x87 __builtin
functions that are always defined for gcc-4.6+, uses
__builtin_copysign instead of homegrown __sgn function to avoid
partial memory stalls.

Since we are in FAST_MATH, we don't need to handle the sign of zero,
so the patch removes

-  return __temp ? __temp : __x

from the definition of expm1.

Patch was tested on x86_64-linux-gnu, and the resulting mathinline.h
was used to calculate test results of all changed functions.

Please note I have no write access to glibc repository.

Uros.

2017-04-26  Uros Bizjak  <ubizjak@gmail.com>

    * sysdeps/x86/fpu/bits/mathinline.h [__FAST_MATH__]
    (__expm1_code): Remove define and undefine.
    [__FAST_MATH__] (__expm1l): Remove inline function.
    [__FAST_MATH__] (__exp_code): Remove define and undefine.
    [__FAST_MATH__] (exp): Remove inline function.
    [__FAST_MATH__] (__expl): Remove inline function.
    [__FAST_MATH__] (__libc_sqrtl): Remove define.
    (fabs): Remove define.
    (fabsf): Remove define.
    (fabsl): Remove define.
    (__fabsl): Remove define.
    (__sgn1l): Remove define.
    [__FAST_MATH__] (sinh): Rewrite using __builtin functions.
    Use __builtin_copysign to calculate sign of the result.
    [__FAST_MATH__] (cosh): Rewrite using __builtin functions.
    [__FAST_MATH__] (tanh): Rewrite using __builtin functions.
    Use __builtin_copysign to calculate sign of the result.
    [__USE_ISOC99 && __FAST_MATH__] (expm1): Remove inline function.
    [__USE_ISOC99 && __FAST_MATH__] (asinh): Rewrite using __builtin
    functions.  Use __builtin_copysign to calculate sign of the result.
    [__USE_ISOC99 && __FAST_MATH__] (acosh): Rewrite using
    __builtin functions.
    [__USE_ISOC99 && __FAST_MATH__] (atanh): Rewrite using __builtin
    functions.  Use __builtin_copysign to calculate sign of the result.
    [__USE_ISOC99 && __FAST_MATH__] (hypot): Rewrite using
    __builtin functions.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>

Attachment: g.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]