sarnex wrote: > GCC has __has_builtin, so how do they handle offloading targets? Do they have > the same odd behavior where __has_builtin returns true for builtins it cannot > actually emit code for?
Setting up offloading for GCC was a nightmare, but it looks like the behavior is the same as clang (available builtins are the union of host + offload). I tried this example: ``` int main() { int x = 0; #pragma omp target { for(int i = 0; i < 100; i++) { #if __has_builtin(__builtin_ia32_pause) __builtin_ia32_pause(); #endif x+= i; } } return x; } ``` with flags: ``` g++-14 -fopenmp -foffload=amdgcn-amdhsa="-march=gfx1103" foo.cpp -fcf-protection=none ``` and i got ``` lto1: fatal error: target specific builtin not available ``` https://github.com/llvm/llvm-project/pull/126324 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits