diff options
author | Haibo Huang <hhb@google.com> | 2020-05-15 01:38:25 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-15 01:38:25 +0000 |
commit | 9e52e9e45785fe1487e8c4285f3d97c6723c48f9 (patch) | |
tree | 30b48e320586c9d4e5beec06e7d903dc3fe55d94 | |
parent | 8a321842eac42c78d9e8681da816da3ab6815eda (diff) | |
parent | a31640c3e7db780005f95e2d66cbb59e48206cf4 (diff) | |
download | FP16-9e52e9e45785fe1487e8c4285f3d97c6723c48f9.tar.gz |
Upgrade FP16 to 4dfe081cf6bcd15db339cf2680b9281b8451eeb3 am: 7cea9a0f20 am: 6321f9ece6 am: 169fc31aa8 am: 654ee0f4d7 am: a31640c3e7
Change-Id: Ie6fe8272604afbf500356495819a472392817551
-rw-r--r-- | METADATA | 6 | ||||
-rw-r--r-- | include/fp16/bitcasts.h | 16 |
2 files changed, 19 insertions, 3 deletions
@@ -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; |