Documentation updated and hardware level detection cleanup.

This commit is contained in:
HedgehogInTheCPP 2026-08-20 18:45:31 +03:00
parent b5b9087150
commit e7a29e0915
3 changed files with 11 additions and 17 deletions

View File

@ -51,10 +51,10 @@ Introduced new optional macros to minimize overhead when certain parsing feature
Automatically uses std::bit_cast if available to reduce code size and speed up.
* **`FASTFLOAT_X86_SIMD`**
Automatically uses reworking SSE parsing algorithms to improve performance on x86 machines.
Automatically uses reworking SSE parsing algorithms to improve performance on x86 machines. And hardware level also can be set manually by user.
* **`FASTFLOAT_USE_SIMD`**
Add possibility to completely disable manual algorithms realization and give compiler more freedom
Can be set to 0 for completely disable manually optimized SIMD paths and use compiler + linker to give the best possible result automatically
---

View File

@ -109,7 +109,7 @@ fastfloat_really_inline uint64_t simd_read8(char16_t const *chars) {
FASTFLOAT_SIMD_RESTORE_WARNINGS
}
#elif defined(FASTFLOAT_ARM_NEON)
#elif FASTFLOAT_ARM_NEON
fastfloat_really_inline uint64_t simd_read8(uint16x8_t const &data) {
uint8x8_t utf8_packed = vmovn_u16(data);

View File

@ -186,14 +186,14 @@ using parse_options = parse_options_t<char>;
#endif
#endif
#ifdef FASTFLOAT_USE_SIMD // user defined
#else
#ifdef FASTFLOAT_X86_SIMD // user defined level
#ifdef FASTFLOAT_USE_SIMD
// user defined
#elif defined(FASTFLOAT_X86_SIMD)
// user defined level
static_assert(FASTFLOAT_X86_SIMD == 20 || FASTFLOAT_X86_SIMD == 42 ||
FASTFLOAT_X86_SIMD == 52,
FASTFLOAT_X86_SIMD == 52 || FASTFLOAT_ARM_NEON,
"FASTFLOAT_X86_SIMD should be 20(SSE2), 42(SSE4.2) and 52(AVX2)");
#else // auto detect
#if defined(__AVX2__)
#elif defined(__AVX2__)
#define FASTFLOAT_X86_SIMD 52
#elif defined(__AVX__)
// On MSVC there's no way to check for SSE4.2 specifically so check AVX.
@ -210,18 +210,13 @@ static_assert(FASTFLOAT_X86_SIMD == 20 || FASTFLOAT_X86_SIMD == 42 ||
(defined(_M_AMD64) || defined(_M_X64) || \
(defined(_M_IX86_FP) && _M_IX86_FP == 2)))
#define FASTFLOAT_X86_SIMD 20
#endif
#endif
#if defined(__aarch64__) || defined(_M_ARM64)
#elif defined(__aarch64__) || defined(_M_ARM64)
#define FASTFLOAT_ARM_NEON 1
#endif
#if defined(FASTFLOAT_X86_SIMD) || defined(FASTFLOAT_ARM_NEON)
#if FASTFLOAT_X86_SIMD || FASTFLOAT_ARM_NEON
#define FASTFLOAT_USE_SIMD 1
#endif
#if FASTFLOAT_USE_SIMD
#if defined(__GNUC__)
// disable -Wcast-align=strict (GCC only)
#define FASTFLOAT_SIMD_DISABLE_WARNINGS \
@ -234,7 +229,6 @@ static_assert(FASTFLOAT_X86_SIMD == 20 || FASTFLOAT_X86_SIMD == 42 ||
#define FASTFLOAT_SIMD_RESTORE_WARNINGS
#endif
#endif
#endif
#ifdef FASTFLOAT_VISUAL_STUDIO
#define fastfloat_really_inline __forceinline