[libclc] 0e98817 - libclc: frexp: fix implementation regarding denormals (#134823)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 06:50:29 PDT 2025
Author: Romaric Jodin
Date: 2025-04-08T14:50:26+01:00
New Revision: 0e9881745834863a6f5a3a05588886bb3eb75cdf
URL: https://github.com/llvm/llvm-project/commit/0e9881745834863a6f5a3a05588886bb3eb75cdf
DIFF: https://github.com/llvm/llvm-project/commit/0e9881745834863a6f5a3a05588886bb3eb75cdf.diff
LOG: libclc: frexp: fix implementation regarding denormals (#134823)
Devices not supporting denormals can compare them true against zero. It
leads to result not matching the CTS expectation when either supporting
or not denormals.
For example for 0x1.008p-140 we get {0x1.008p-140, 0} while the CTS
expects {0x1.008p-1, -139} when supporting denormals, or {0, 0} when not
supporting denormals (flushed to zero).
Ref #129871
Added:
Modified:
libclc/clc/lib/generic/math/clc_frexp.inc
Removed:
################################################################################
diff --git a/libclc/clc/lib/generic/math/clc_frexp.inc b/libclc/clc/lib/generic/math/clc_frexp.inc
index 640d02cb3209d..d212b6a1b3376 100644
--- a/libclc/clc/lib/generic/math/clc_frexp.inc
+++ b/libclc/clc/lib/generic/math/clc_frexp.inc
@@ -26,7 +26,7 @@ __clc_frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) {
(ai & (__CLC_INTN)MANTBITS_SP32);
__CLC_INTN is_inf_nan_or_zero =
- x == __CLC_FP_LIT(0.0) || __clc_isinf(x) || __clc_isnan(x);
+ ai == (__CLC_INTN)0 || __clc_isinf(x) || __clc_isnan(x);
*ep = __clc_select(e, (__CLC_INTN)0, is_inf_nan_or_zero);
return __clc_select(__CLC_AS_GENTYPE(i), x, is_inf_nan_or_zero);
}
More information about the cfe-commits
mailing list