[libc-commits] [libc] 062d24a - [libc][math] Fix some mis-optimization issue with hypotf16. (#141960)
via libc-commits
libc-commits at lists.llvm.org
Thu May 29 08:34:54 PDT 2025
Author: lntue
Date: 2025-05-29T11:34:50-04:00
New Revision: 062d24a7d6770b1dd7d5a4968bccb28c85495d67
URL: https://github.com/llvm/llvm-project/commit/062d24a7d6770b1dd7d5a4968bccb28c85495d67
DIFF: https://github.com/llvm/llvm-project/commit/062d24a7d6770b1dd7d5a4968bccb28c85495d67.diff
LOG: [libc][math] Fix some mis-optimization issue with hypotf16. (#141960)
Added:
Modified:
libc/src/math/generic/hypotf16.cpp
Removed:
################################################################################
diff --git a/libc/src/math/generic/hypotf16.cpp b/libc/src/math/generic/hypotf16.cpp
index 8f80986204b27..d782c2687cdb6 100644
--- a/libc/src/math/generic/hypotf16.cpp
+++ b/libc/src/math/generic/hypotf16.cpp
@@ -48,10 +48,13 @@ LLVM_LIBC_FUNCTION(float16, hypotf16, (float16 x, float16 y)) {
return a_bits.get_val();
}
+ // TODO: Investigate why replacing the return line below with:
+ // return x_bits.get_val() + y_bits.get_val();
+ // fails the hypotf16 smoke tests.
if (LIBC_UNLIKELY(a_u - b_u >=
static_cast<uint16_t>((FPBits::FRACTION_LEN + 2)
<< FPBits::FRACTION_LEN)))
- return x_abs.get_val() + y_abs.get_val();
+ return a_bits.get_val() + b_bits.get_val();
float af = fputil::cast<float>(a_bits.get_val());
float bf = fputil::cast<float>(b_bits.get_val());
More information about the libc-commits
mailing list