@@ -36,26 +36,28 @@ namespace math {
3636
3737#if __cplusplus >= 201703L
3838template <typename Tp>
39- typename std::enable_if <std::is_same_v<Tp, float >, float >::type saturate (Tp x) {
39+ std::enable_if_t <std::is_same_v<Tp, float >, float > saturate (Tp x) {
4040 return __imf_saturatef (x);
4141}
4242
43- template <typename Tp> Tp copysign (Tp x, Tp y) {
44- static_assert (std::is_same_v<Tp, float > || std::is_same_v<Tp, double > ||
45- std::is_same_v<Tp, sycl::half>,
46- " sycl::ext::intel::math::copysign only supports fp16, fp32, "
47- " fp64 version." );
48- if constexpr (std::is_same_v<Tp, float >)
49- return __imf_copysignf (x, y);
50- if constexpr (std::is_same_v<Tp, double >)
51- return __imf_copysign (x, y);
52- if constexpr (std::is_same_v<Tp, sycl::half>) {
53- static_assert (sizeof (sycl::half) == sizeof (_iml_half_internal),
54- " sycl::half is not compatible with _iml_half_internal." );
55- _iml_half_internal xi = __builtin_bit_cast (_iml_half_internal, x);
56- _iml_half_internal yi = __builtin_bit_cast (_iml_half_internal, y);
57- return __builtin_bit_cast (sycl::half, __imf_copysignf16 (xi, yi));
58- }
43+ template <typename Tp>
44+ std::enable_if_t <std::is_same_v<Tp, float >, float > copysign (Tp x, Tp y) {
45+ return __imf_copysignf (x, y);
46+ }
47+
48+ template <typename Tp>
49+ std::enable_if_t <std::is_same_v<Tp, double >, double > copysign (Tp x, Tp y) {
50+ return __imf_copysign (x, y);
51+ }
52+
53+ template <typename Tp>
54+ std::enable_if_t <std::is_same_v<Tp, sycl::half>, sycl::half> copysign (Tp x,
55+ Tp y) {
56+ static_assert (sizeof (sycl::half) == sizeof (_iml_half_internal),
57+ " sycl::half is not compatible with _iml_half_internal." );
58+ _iml_half_internal xi = __builtin_bit_cast (_iml_half_internal, x);
59+ _iml_half_internal yi = __builtin_bit_cast (_iml_half_internal, y);
60+ return __builtin_bit_cast (sycl::half, __imf_copysignf16 (xi, yi));
5961}
6062
6163#endif
0 commit comments