[libc-commits] [libc] [libc][math] Fix some mis-optimization issue with hypotf16. (PR #141960)
via libc-commits
libc-commits at lists.llvm.org
Thu May 29 08:03:50 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: None (lntue)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/141960.diff
1 Files Affected:
- (modified) libc/src/math/generic/hypotf16.cpp (+4-1)
``````````diff
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());
``````````
</details>
https://github.com/llvm/llvm-project/pull/141960
More information about the libc-commits
mailing list