16
16
17
17
// The 'sycl_device_only' attribute enables device-side overloading.
18
18
#define __SYCL_DEVICE __attribute__ ((sycl_device_only, always_inline))
19
- #define __SYCL_DEVICE_C \
20
- extern " C" __attribute__((sycl_device_only, always_inline))
19
+ #define __SYCL_DEVICE_C extern " C" __SYCL_DEVICE
21
20
22
21
#include < type_traits>
23
22
@@ -259,9 +258,16 @@ __SYCL_SPIRV_MAP_BINARY_C(nextafter);
259
258
__SYCL_SPIRV_MAP_BINARY_C (copysign);
260
259
261
260
// / Classification and comparison
262
- //
263
261
264
- // unsupported: fpclassify
262
+ __SYCL_DEVICE_C int fpclassify (float x) {
263
+ return __builtin_fpclassify (FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
264
+ FP_ZERO, x);
265
+ }
266
+ __SYCL_DEVICE_C int fpclassify (double x) {
267
+ return __builtin_fpclassify (FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
268
+ FP_ZERO, x);
269
+ }
270
+
265
271
// unsupported: isfinite
266
272
// unsupported: isinf
267
273
// unsupported: isnan
@@ -460,7 +466,7 @@ template <typename T> __SYCL_DEVICE __sycl_promote_t<T> scalbn(T x, int exp) {
460
466
__SYCL_SPIRV_MAP_BINARY_CXX (copysign);
461
467
462
468
// Classification and comparison
463
- // using ::fpclassify;
469
+ using ::fpclassify;
464
470
// using ::isfinite;
465
471
// using ::isgreater;
466
472
// using ::isgreaterequal;
@@ -482,11 +488,29 @@ _GLIBCXX_END_NAMESPACE_VERSION
482
488
} // namespace std
483
489
#endif
484
490
491
+ #if defined(_WIN32)
492
+ __SYCL_DEVICE_C double _Cosh (double x, double y) { return cosh (x) * y; }
493
+ __SYCL_DEVICE_C float _FCosh (float x, float y) { return coshf (x) * y; }
494
+ __SYCL_DEVICE_C short _Dtest (double *p) { return fpclassify (*p); }
495
+ __SYCL_DEVICE_C short _FDtest (float *p) { return fpclassify (*p); }
496
+ __SYCL_DEVICE_C double _Sinh (double x, double y) { return sinh (x) * y; }
497
+ __SYCL_DEVICE_C float _FSinh (float x, float y) { return sinhf (x) * y; }
498
+ __SYCL_DEVICE_C short _Exp (double *px, double y, short eoff) {
499
+ return exp (*px) * ldexp (y, eoff);
500
+ }
501
+ __SYCL_DEVICE_C short _FExp (float *px, float y, short eoff) {
502
+ return exp (*px) * ldexp (y, eoff);
503
+ }
504
+ __SYCL_DEVICE_C float _hypotf (float x, float y) { return hypotf (x, y); }
505
+ __SYCL_DEVICE_C int _fdsign (float x) { return __builtin_signbit (x); }
506
+ __SYCL_DEVICE_C int _dsign (double x) { return __builtin_signbit (x); }
507
+ #endif // defined(_WIN32)
508
+
485
509
#undef __SYCL_SPIRV_MAP_BINARY_C
486
510
#undef __SYCL_SPIRV_MAP_BINARY_CXX
487
511
#undef __SYCL_SPIRV_MAP_UNARY_C
488
512
#undef __SYCL_SPIRV_MAP_UNARY_CXX
489
513
#undef __SYCL_DEVICE_C
490
514
#undef __SYCL_DEVICE
491
- #endif
492
- #endif
515
+ #endif // __SYCL_DEVICE_ONLY__
516
+ #endif // __SYCL_CMATH_WRAPPER_IMPL_HPP__
0 commit comments