Skip to content

Commit 062d24a

Browse files
authored
[libc][math] Fix some mis-optimization issue with hypotf16. (#141960)
1 parent 7521ce9 commit 062d24a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libc/src/math/generic/hypotf16.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ LLVM_LIBC_FUNCTION(float16, hypotf16, (float16 x, float16 y)) {
4848
return a_bits.get_val();
4949
}
5050

51+
// TODO: Investigate why replacing the return line below with:
52+
// return x_bits.get_val() + y_bits.get_val();
53+
// fails the hypotf16 smoke tests.
5154
if (LIBC_UNLIKELY(a_u - b_u >=
5255
static_cast<uint16_t>((FPBits::FRACTION_LEN + 2)
5356
<< FPBits::FRACTION_LEN)))
54-
return x_abs.get_val() + y_abs.get_val();
57+
return a_bits.get_val() + b_bits.get_val();
5558

5659
float af = fputil::cast<float>(a_bits.get_val());
5760
float bf = fputil::cast<float>(b_bits.get_val());

0 commit comments

Comments
 (0)