================
@@ -0,0 +1,21 @@
+#ifndef __CLC_INTEGER_CLC_CLZ_H__
+#define __CLC_INTEGER_CLC_CLZ_H__
+
+#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
+// clspv and spir-v targets provide their own OpenCL-compatible clz
+#define __clc_clz clz
----------------
frasercrmck wrote:

Oh right, I thought we were okay with this pattern given previous PRs were 
using it.

It's a bit awkard. The clspv/spirv targets don't provide implementations of all 
OpenCL builtins. They don't want to provide `clz`, in this instance. But we're 
going to see, for example, `__clc_remquo` call out to `__clc_clz`. We can't 
leave a dangling reference to `__clc_clz` - we need to replace that with a 
redirection to `clz` somehow. This macro solution seemed like the simplest way, 
and one that would introduce no - or minimal - changes to the bytecode for 
those targets. Since they're both primarily used by downstream users I favoured 
the lightest possible touch.

The other solution would be to have those targets define `__clz_clz` to call 
out to `clz`. That would be more code, and introduce more indirection, but 
would be functionally equivalent. I'd have to go back and make the change for 
the other instances of this pattern already merged.

Do you have another idea of how we could accomplish this?

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

Reply via email to