https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88474

            Bug ID: 88474
           Summary: Inline built-in hypot for -ffast-math
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org
  Target Milestone: ---
            Target: i?86-*-*

GCC should support inline code generation for hypot functions, under
appropriate fast-math conditions.

glibc's bits/mathinline.h, for 32-bit non-SSE fast-math x86 only, has:

/* The argument range of the inline version of hypotl is slightly reduced.  */
__inline_mathcodeNP2 (hypot, __x, __y,
                      return __libc_sqrtl (__x * __x + __y * __y))

We're moving away from such inlines in glibc, preferring to leave it to the
compiler to inline standard functions under appropriate conditions.  Although
this is filed as a target issue, inlining hypot functions (given
-funsafe-math-optimizations, as it may change results, and -ffinite-math-only,
as it won't be correct for Inf, NaN arguments) is actually reasonably generic. 
There are separate cases for when it's possible to do the * + sqrt operations
on a wider (hardware) type, so avoiding reducing the argument range, and when a
wider hardware type is unavailable or inappropriate to use, in which case the
argument range would be reduced by inlining (although that glibc inline still
does it for long double).

Reply via email to