aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-05-15 01:24:35 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-15 01:24:35 +0000
commita31640c3e7db780005f95e2d66cbb59e48206cf4 (patch)
tree30b48e320586c9d4e5beec06e7d903dc3fe55d94
parent40b15c5d81c199aa498dcb9c79529372e5065165 (diff)
parent654ee0f4d735470b425907508658b06cdc1c2d64 (diff)
downloadFP16-a31640c3e7db780005f95e2d66cbb59e48206cf4.tar.gz
Upgrade FP16 to 4dfe081cf6bcd15db339cf2680b9281b8451eeb3 am: 7cea9a0f20 am: 6321f9ece6 am: 169fc31aa8 am: 654ee0f4d7
Change-Id: I1d33add94268f678607f500555588706b0c780c5
-rw-r--r--METADATA6
-rw-r--r--include/fp16/bitcasts.h16
2 files changed, 19 insertions, 3 deletions
diff --git a/METADATA b/METADATA
index 5d4ed15..437b9ba 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
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 @@ static inline float fp32_from_bits(uint32_t w) {
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 @@ static inline uint32_t fp32_to_bits(float f) {
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 @@ static inline double fp64_from_bits(uint64_t w) {
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 @@ static inline uint64_t fp64_to_bits(double f) {
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;