nvcc and nvc++ (as well as pgcc and pgc++) return true for __has_builtin(__builthin_expect_with_probability)
, but if used in code results in undefined reference to
__builtin_expect_with_probability’`.
Simple test case:
#if defined(__has_builtin)
# if __has_builtin(__builtin_expect_with_probability)
# define FOO_EXPECT(expr, value, probability) __builtin_expect_with_probability((expr), (value), (probability))
# endif
#endif
#if !defined(FOO_EXPECT)
# define FOO_EXPECT(expr, value, probability) (expr)
#endif
int main(int argc, char** argv) {
return FOO_EXPECT(argc & 1, 1, 0.75);
}
This is with 20.7-0 on x86_64.
Sorry for not mentioning which builtin in the title; if I add it I just get a pop-up that says the title doesn’t look like a complete sentence…