16
16
namespace sycl {
17
17
inline namespace _V1 {
18
18
19
+ template <typename T> static auto process_arg_for_macos (T x) {
20
+ // Workaround for MacOS that doesn't provide some std::is* functions as
21
+ // overloads over FP types (e.g., isfinite)
22
+ if constexpr (std::is_same_v<T, half>)
23
+ return static_cast <float >(x);
24
+ else
25
+ return x;
26
+ }
27
+
19
28
#if defined(__GNUC__) && !defined(__clang__)
20
29
// sycl::vec has UB in operator[] (aliasing violation) that causes the following
21
30
// warning here. Note that the way this #pragma works is that we have to put it
@@ -36,7 +45,9 @@ inline namespace _V1 {
36
45
} \
37
46
EXPORT_SCALAR_AND_VEC_1_16 (NUM_ARGS, NAME, FP_TYPES)
38
47
#define REL_BUILTIN (NUM_ARGS, NAME ) \
39
- REL_BUILTIN_CUSTOM (NUM_ARGS, NAME, std::NAME)
48
+ REL_BUILTIN_CUSTOM (NUM_ARGS, NAME, [](auto ... xs) { \
49
+ return std::NAME (process_arg_for_macos (xs)...); \
50
+ })
40
51
41
52
#if defined(__GNUC__) && !defined(__clang__)
42
53
#pragma GCC diagnostic pop
@@ -57,10 +68,9 @@ REL_BUILTIN(ONE_ARG, isfinite)
57
68
REL_BUILTIN (ONE_ARG, isinf)
58
69
REL_BUILTIN (ONE_ARG, isnan)
59
70
REL_BUILTIN (ONE_ARG, isnormal)
71
+ REL_BUILTIN (TWO_ARGS, isunordered)
60
72
REL_BUILTIN_CUSTOM (TWO_ARGS, isordered,
61
- ([](auto x, auto y) { return !std::isunordered (x, y); }))
62
- REL_BUILTIN_CUSTOM (TWO_ARGS, isunordered,
63
- ([](auto x, auto y) { return std::isunordered (x, y); }))
73
+ ([](auto x, auto y) { return !sycl::isunordered (x, y); }))
64
74
#if defined(__GNUC__) && !defined(__clang__)
65
75
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112816
66
76
#pragma GCC push_options
0 commit comments