Skip to content

Commit 07c60c8

Browse files
[SYCL] Move called function declaration to avoid recursion (#10652)
__vSignBitSet for float will in certain cases, due to a bug in GCC, convert its argument to double and call the corresponding function. To avoid recursion, the called double overload needs to be defined before the caller. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent b7a43a4 commit 07c60c8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sycl/source/detail/builtins_relational.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ __SYCL_EXPORT rel_res_t sycl_host_SignBitSet(s::cl_float x) __NOEXC {
458458
__SYCL_EXPORT rel_res_t sycl_host_SignBitSet(s::cl_double x) __NOEXC {
459459
return std::signbit(x);
460460
}
461+
__SYCL_EXPORT s::cl_long __vSignBitSet(s::cl_double x) __NOEXC {
462+
return -static_cast<s::cl_long>(std::signbit(x));
463+
}
461464
__SYCL_EXPORT s::cl_int __vSignBitSet(s::cl_float x) __NOEXC {
462465
#ifdef __GNUC__
463466
// GCC 11.3 and later is stumbling with an internal compiler error
@@ -469,9 +472,6 @@ __SYCL_EXPORT s::cl_int __vSignBitSet(s::cl_float x) __NOEXC {
469472
return -static_cast<s::cl_int>(std::signbit(x));
470473
#endif
471474
}
472-
__SYCL_EXPORT s::cl_long __vSignBitSet(s::cl_double x) __NOEXC {
473-
return -static_cast<s::cl_long>(std::signbit(x));
474-
}
475475
__SYCL_EXPORT rel_res_t sycl_host_SignBitSet(s::cl_half x) __NOEXC {
476476
return std::signbit(d::cast_if_host_half(x));
477477
}

0 commit comments

Comments
 (0)