================ @@ -345,10 +345,15 @@ static __inline int __get_cpuid_count (unsigned int __leaf, // In some configurations, __cpuidex is defined as a builtin (primarily // -fms-extensions) which will conflict with the __cpuidex definition below. #if !(__has_builtin(__cpuidex)) +// In some cases, offloading will set the host as the aux triple and define the +// builtin. Given __has_builtin does not detect builtins on aux triples, we need +// to explicitly check for some offloading cases. +#ifndef __NVPTX__ ---------------- sarnex wrote:
Thanks so much for the quick investigation! I'm not really familiar with CUDA offloading but if the `cc1` command is `cc1 -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu`, `__has_builtin(__cpuidex)` returning false seems correct, so I would think the actual root cause is that `cpuidex` is getting defined for CUDA with `nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu`. If so, I'm happy to have this workaround for now but we might want to file a tracker somewhere for the root cause to be investigated. https://github.com/llvm/llvm-project/pull/152556 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits