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

Yeah, I'm not sure using `frexp` is currently better given that there's no 
native path for it. We talked about allowing that in [the frexp 
PR](https://github.com/llvm/llvm-project/pull/127836#pullrequestreview-2628596638).

But yeah even in that case, if we use the builtin/intrinsic for `frexp` it's 
not necessarily the case that it's faster than this implementation for `ilogb`. 
So I think the logb/ilogb-specific utility function would be the way to go.

I don't think we've got canonical examples of target-specific code paths for 
utility functions in libclc. We could do it with the `SOURCES` system, or 
[preprocessor 
defines](https://github.com/llvm/llvm-project/blob/main/libclc/clc/include/clc/math/math.h#L41-L48)
 or some other system. I'm not yet sure.

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