[libclc] libclc: frexp: fix implementation regarding denormals (PR #134823)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 06:46:15 PDT 2025


================
@@ -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);
----------------
frasercrmck wrote:

> Yes, this is correct for `-0.0`, `ai` is the bitcast of the absolute value of `x`.

Oh I'm silly, yes of course. Not sure how I thought the opposite was going on!

https://github.com/llvm/llvm-project/pull/134823


More information about the cfe-commits mailing list