[libc-commits] [PATCH] D118157: [libc] Improve hypotf performance with different algorithm correctly rounded to all rounding modes.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jan 25 09:19:10 PST 2022


sivachandra added inline comments.


================
Comment at: libc/src/math/generic/hypotf.cpp:22
+  // These squares are exact.
+  double xSq = xd * xd;
+  double ySq = yd * yd;
----------------
Incorrect variable naming style at many places in this function.


================
Comment at: libc/src/math/generic/hypotf.cpp:32
+  // Take sqrt in double precision.
+  DoubleBits result(__builtin_sqrt(sumSq));
+
----------------
A call to a target independent builtin for a standard function can lead to a call back to the libc. That is, compilers are free to call the `sqrt` function from the libc. We can refactor our `sqrt` implementation so that we can replace this call to `__builtin_sqrt` with a call to LLVM libc's `sqrt`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118157/new/

https://reviews.llvm.org/D118157



More information about the libc-commits mailing list