================
@@ -0,0 +1,73 @@
+#if __CLC_FPSIZE == 32
+
+_CLC_OVERLOAD _CLC_DEF __CLC_INTN __clc_ilogb(__CLC_GENTYPE x) {
+  __CLC_UINTN ux = __CLC_AS_UINTN(x);
----------------
arsenm wrote:

This should be implemented in terms of frexp and avoid relying on the exponent 
bits.

Something like:
```
int ilogb(float x) {
    int result;
    (void)frexp(x, &result);
    result = isnan(x) ? FP_ILOGBNAN : result;
    result = isinf(x) ? INT_MAX : result;
    return x == 0.0 ? FP_ILOGB0 : result;
}
```

Might be able to avoid the edge case handling too
    

    





```




https://github.com/llvm/llvm-project/pull/128028
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to