From 0854aa15c4171201da8eae9b668438c704dc58fc Mon Sep 17 00:00:00 2001 From: Marat Dukhan Date: Wed, 19 Jun 2024 13:00:41 -0700 Subject: [PATCH] Use Intel bitcast intrinsics with recent MSVC --- include/fp16/bitcasts.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fp16/bitcasts.h b/include/fp16/bitcasts.h index 7dbb516..1de8d24 100644 --- a/include/fp16/bitcasts.h +++ b/include/fp16/bitcasts.h @@ -22,7 +22,7 @@ static inline float fp32_from_bits(uint32_t w) { return as_float(w); #elif defined(__CUDA_ARCH__) return __uint_as_float((unsigned int) w); -#elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) || defined(_MSC_VER) && (_MSC_VER >= 1932) && (defined(_M_IX86) || defined(_M_X64)) return _castu32_f32(w); #elif defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64)) return _CopyFloatFromInt32((__int32) w); @@ -40,7 +40,7 @@ static inline uint32_t fp32_to_bits(float f) { return as_uint(f); #elif defined(__CUDA_ARCH__) return (uint32_t) __float_as_uint(f); -#elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) || defined(_MSC_VER) && (_MSC_VER >= 1932) && (defined(_M_IX86) || defined(_M_X64)) return _castf32_u32(f); #elif defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64)) return (uint32_t) _CopyInt32FromFloat(f); @@ -58,7 +58,7 @@ static inline double fp64_from_bits(uint64_t w) { return as_double(w); #elif defined(__CUDA_ARCH__) return __longlong_as_double((long long) w); -#elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) || defined(_MSC_VER) && (_MSC_VER >= 1932) && (defined(_M_IX86) || defined(_M_X64)) return _castu64_f64(w); #elif defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64)) return _CopyDoubleFromInt64((__int64) w); @@ -76,7 +76,7 @@ static inline uint64_t fp64_to_bits(double f) { return as_ulong(f); #elif defined(__CUDA_ARCH__) return (uint64_t) __double_as_longlong(f); -#elif defined(__INTEL_COMPILER) +#elif defined(__INTEL_COMPILER) || defined(_MSC_VER) && (_MSC_VER >= 1932) && (defined(_M_IX86) || defined(_M_X64)) return _castf64_u64(f); #elif defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64)) return (uint64_t) _CopyInt64FromDouble(f);