[libclc] [libclc] replace float remquo with amd ocml implementation (PR #177131)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 09:06:49 PST 2026


jhuber6 wrote:

> I ran into [this issue](https://github.com/llvm/llvm-project/pull/178143#issuecomment-3836603683).
> 
> ```
> cd /home/fedora/src/llvm-project/main/build/runtimes/runtimes-bins/libclc && /home/fedora/src/llvm-project/main/build/bin/clang-23 -c --target=spirv32-- -x ir -o /home/fedora/src/llvm-project/main/build/./lib/clang/23/lib/spirv32--/libclc.spv /home/fedora/src/llvm-project/main/build/runtimes/runtimes-bins/libclc/obj.libclc.dir/spirv-mesa3d-/builtins.link.spirv-mesa3d-.bc
> fatal error: error in backend: unable to legalize instruction: %88:fid(s32) = G_FCANONICALIZE %87:fid (in function: _Z12__clc_remquoffPi)
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
> Stack dump:
> 0.      Program arguments: /home/fedora/src/llvm-project/main/build/bin/clang-23 -c --target=spirv32-- -x ir -o /home/fedora/src/llvm-project/main/build/./lib/clang/23/lib/spirv32--/libclc.spv /home/fedora/src/llvm-project/main/build/runtimes/runtimes-bins/libclc/obj.libclc.dir/spirv-mesa3d-/builtins.link.spirv-mesa3d-.bc
> 1.      Code generation
> 2.      Running pass 'Function Pass Manager' on module '/home/fedora/src/llvm-project/main/build/runtimes/runtimes-bins/libclc/obj.libclc.dir/spirv-mesa3d-/builtins.link.spirv-mesa3d-.bc'.
> 3.      Running pass 'Legalizer' on function '@_Z12__clc_remquoffPi'
> ```
> 
> `ret = c ? t : __builtin_elementwise_canonicalize(x);` was added in this PR.

Either tell the SPIR-V backend people to support the canonicalize node or put `#ifdef __SPIRV__` around this usage.

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


More information about the cfe-commits mailing list