Upgrade FP16 to 4dfe081cf6bcd15db339cf2680b9281b8451eeb3 am: 7cea9a0f20 am: 6321f9ece6 am: 169fc31aa8 am: 654ee0f4d7
Change-Id: I1d33add94268f678607f500555588706b0c780c5
diff --git a/METADATA b/METADATA
index 5d4ed15..437b9ba 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
type: GIT
value: "https://github.com/Maratyszcza/FP16"
}
- version: "3c54eacb74f6f5e39077300c5564156c424d77ba"
+ version: "4dfe081cf6bcd15db339cf2680b9281b8451eeb3"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 4
- day: 13
+ month: 5
+ day: 14
}
}
diff --git a/include/fp16/bitcasts.h b/include/fp16/bitcasts.h
index 26a755c..86a4e22 100644
--- a/include/fp16/bitcasts.h
+++ b/include/fp16/bitcasts.h
@@ -8,6 +8,14 @@
#include <stdint.h>
#endif
+#if defined(__INTEL_COMPILER)
+ #include <immintrin.h>
+#endif
+
+#if defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
+ #include <intrin.h>
+#endif
+
static inline float fp32_from_bits(uint32_t w) {
#if defined(__OPENCL_VERSION__)
@@ -16,6 +24,8 @@
return __uint_as_float((unsigned int) w);
#elif defined(__INTEL_COMPILER)
return _castu32_f32(w);
+#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
+ return _CopyFloatFromInt32((__int32) w);
#else
union {
uint32_t as_bits;
@@ -32,6 +42,8 @@
return (uint32_t) __float_as_uint(f);
#elif defined(__INTEL_COMPILER)
return _castf32_u32(f);
+#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
+ return (uint32_t) _CopyInt32FromFloat(f);
#else
union {
float as_value;
@@ -48,6 +60,8 @@
return __longlong_as_double((long long) w);
#elif defined(__INTEL_COMPILER)
return _castu64_f64(w);
+#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
+ return _CopyDoubleFromInt64((__int64) w);
#else
union {
uint64_t as_bits;
@@ -64,6 +78,8 @@
return (uint64_t) __double_as_longlong(f);
#elif defined(__INTEL_COMPILER)
return _castf64_u64(f);
+#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
+ return (uint64_t) _CopyInt64FromDouble(f);
#else
union {
double as_value;