aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-06-25 11:08:17 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-06-25 11:08:17 +0300
commitd72e335b04a09eb5303cf0994c29c327556d8a93 (patch)
treeece9c0d9fe044bee8ab0903525e156f987c3915e
parent62b675742156dd4471435b3da5dbca87065a2d0f (diff)
downloadydb-d72e335b04a09eb5303cf0994c29c327556d8a93.tar.gz
Update contrib/restricted/fast_float to 5.2.0
-rw-r--r--contrib/restricted/fast_float/README.md2
-rw-r--r--contrib/restricted/fast_float/include/fast_float/ascii_number.h50
-rw-r--r--contrib/restricted/fast_float/include/fast_float/float_common.h14
-rw-r--r--contrib/restricted/fast_float/ya.make4
4 files changed, 57 insertions, 13 deletions
diff --git a/contrib/restricted/fast_float/README.md b/contrib/restricted/fast_float/README.md
index 8dffa06a96..f12dea551e 100644
--- a/contrib/restricted/fast_float/README.md
+++ b/contrib/restricted/fast_float/README.md
@@ -264,7 +264,7 @@ the command line help.
You may directly download automatically generated single-header files:
-https://github.com/fastfloat/fast_float/releases/download/v3.4.0/fast_float.h
+https://github.com/fastfloat/fast_float/releases/download/v5.2.0/fast_float.h
## Credit
diff --git a/contrib/restricted/fast_float/include/fast_float/ascii_number.h b/contrib/restricted/fast_float/include/fast_float/ascii_number.h
index 481b91df76..eea2f672a6 100644
--- a/contrib/restricted/fast_float/include/fast_float/ascii_number.h
+++ b/contrib/restricted/fast_float/include/fast_float/ascii_number.h
@@ -13,6 +13,9 @@
#include <emmintrin.h>
#endif
+#ifdef FASTFLOAT_NEON
+#include <arm_neon.h>
+#endif
namespace fast_float {
@@ -88,10 +91,29 @@ FASTFLOAT_SIMD_DISABLE_WARNINGS
FASTFLOAT_SIMD_RESTORE_WARNINGS
}
-#endif
+#elif defined(FASTFLOAT_NEON)
+
+
+fastfloat_really_inline
+uint64_t simd_read8_to_u64(const uint16x8_t data) {
+FASTFLOAT_SIMD_DISABLE_WARNINGS
+ uint8x8_t utf8_packed = vmovn_u16(data);
+ return vget_lane_u64(vreinterpret_u64_u8(utf8_packed), 0);
+FASTFLOAT_SIMD_RESTORE_WARNINGS
+}
+
+fastfloat_really_inline
+uint64_t simd_read8_to_u64(const char16_t* chars) {
+FASTFLOAT_SIMD_DISABLE_WARNINGS
+ return simd_read8_to_u64(vld1q_u16(reinterpret_cast<const uint16_t*>(chars)));
+FASTFLOAT_SIMD_RESTORE_WARNINGS
+}
+
+#endif // FASTFLOAT_SSE2
// dummy for compile
-template <typename UC, FASTFLOAT_ENABLE_IF(!has_simd_opt<UC>())>
+//template <typename UC, FASTFLOAT_ENABLE_IF(!has_simd_opt<UC>())>
+template <typename UC>
uint64_t simd_read8_to_u64(UC const*) {
return 0;
}
@@ -170,14 +192,32 @@ FASTFLOAT_SIMD_DISABLE_WARNINGS
}
else return false;
FASTFLOAT_SIMD_RESTORE_WARNINGS
-#endif
+#elif defined(FASTFLOAT_NEON)
+FASTFLOAT_SIMD_DISABLE_WARNINGS
+ const uint16x8_t data = vld1q_u16(reinterpret_cast<const uint16_t*>(chars));
+
+ // (x - '0') <= 9
+ // http://0x80.pl/articles/simd-parsing-int-sequences.html
+ const uint16x8_t t0 = vsubq_u16(data, vmovq_n_u16('0'));
+ const uint16x8_t mask = vcltq_u16(t0, vmovq_n_u16('9' - '0' + 1));
+
+ if (vminvq_u16(mask) == 0xFFFF) {
+ i = i * 100000000 + parse_eight_digits_unrolled(simd_read8_to_u64(data));
+ return true;
+ }
+ else return false;
+FASTFLOAT_SIMD_RESTORE_WARNINGS
+#else
+ (void)chars; (void)i;
+ return false;
+#endif // FASTFLOAT_SSE2
}
-#endif
+#endif // FASTFLOAT_HAS_SIMD
// dummy for compile
template <typename UC, FASTFLOAT_ENABLE_IF(!has_simd_opt<UC>())>
-uint64_t simd_parse_if_eight_digits_unrolled(UC const*, uint64_t&) {
+bool simd_parse_if_eight_digits_unrolled(UC const*, uint64_t&) {
return 0;
}
diff --git a/contrib/restricted/fast_float/include/fast_float/float_common.h b/contrib/restricted/fast_float/include/fast_float/float_common.h
index b1622b0f21..1998b1094c 100644
--- a/contrib/restricted/fast_float/include/fast_float/float_common.h
+++ b/contrib/restricted/fast_float/include/fast_float/float_common.h
@@ -121,7 +121,11 @@ using parse_options = parse_options_t<char>;
#define FASTFLOAT_SSE2 1
#endif
-#ifdef FASTFLOAT_SSE2
+#if defined(__aarch64__) || defined(_M_ARM64)
+#define FASTFLOAT_NEON 1
+#endif
+
+#if defined(FASTFLOAT_SSE2) || defined(FASTFLOAT_ARM64)
#define FASTFLOAT_HAS_SIMD 1
#endif
@@ -568,10 +572,10 @@ template <> inline constexpr binary_format<double>::equiv_uint
template<typename T>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20
void to_float(bool negative, adjusted_mantissa am, T &value) {
- using uint = typename binary_format<T>::equiv_uint;
- uint word = (uint)am.mantissa;
- word |= uint(am.power2) << binary_format<T>::mantissa_explicit_bits();
- word |= uint(negative) << binary_format<T>::sign_index();
+ using fastfloat_uint = typename binary_format<T>::equiv_uint;
+ fastfloat_uint word = (fastfloat_uint)am.mantissa;
+ word |= fastfloat_uint(am.power2) << binary_format<T>::mantissa_explicit_bits();
+ word |= fastfloat_uint(negative) << binary_format<T>::sign_index();
#if FASTFLOAT_HAS_BIT_CAST
value = std::bit_cast<T>(word);
#else
diff --git a/contrib/restricted/fast_float/ya.make b/contrib/restricted/fast_float/ya.make
index f48a8de4f0..154485e259 100644
--- a/contrib/restricted/fast_float/ya.make
+++ b/contrib/restricted/fast_float/ya.make
@@ -10,9 +10,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(5.1.0)
+VERSION(5.2.0)
-ORIGINAL_SOURCE(https://github.com/fastfloat/fast_float/archive/v5.1.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/fastfloat/fast_float/archive/v5.2.0.tar.gz)
NO_COMPILER_WARNINGS()