From f7124c2f11d04a2db46bc0d85d1cd6a0e4c511a2 Mon Sep 17 00:00:00 2001 From: MacroModel Date: Tue, 29 Aug 2023 18:21:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Utils/json/parser.h | 43 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/src/Utils/json/parser.h b/src/Utils/json/parser.h index f4d5a31..e9e7b1d 100644 --- a/src/Utils/json/parser.h +++ b/src/Utils/json/parser.h @@ -31,38 +31,21 @@ struct char_type const *const json_end_ptr{}; }; -#ifdef __has_builtin -#if (defined(__SSE4_1__) || defined(__AVX2__) || defined(__AVX512VBMI__) || defined(__ARM_NEON)) && __has_builtin(__builtin_shuffle) -#include "parser_sppr_shuffle_impl.h" -#else -template -#if __has_cpp_attribute(__gnu__::__cold__) -[[__gnu__::__cold__]] +#if defined(__has_builtin) +#if __has_builtin(__builtin_shuffle) +#if defined(__AVX512VBMI__) +#define MACRO_JSON_SHUFFLE +#elif defined(__SSE4_1__) && !defined(__AVX__) +#define MACRO_JSON_SHUFFLE +#elif defined(__AVX2__) && !(defined(__AVX51F__) || defined(__AVX512BW__) || defined(__AVX512VL__) || defined(__AVX512DQ__)) +#define MACRO_JSON_SHUFFLE +#endif #endif -inline constexpr char_type * -string_to_be_parsed_print_reserve_impl(char_type *__restrict iter, char_type const *__restrict begin, char_type const *__restrict end, char_type const *const __restrict json_end) { -#if __cpp_if_consteval >= 202106L - if consteval -#else - if (__builtin_is_constant_evaluated()) [[unlikely]] -#endif - { - // to do - } else { - constexpr ::std::size_t N{::fast_io::details::optimal_simd_vector_run_with_cpu_instruction_size}; - if constexpr (N) { - constexpr bool mask{::fast_io::details::calculate_can_intrinsics_accelerate_mask(::fast_io::details::optimal_simd_vector_run_with_cpu_instruction_size)}; - if constexpr (mask) { -#include "parser_sppr_mask_impl.h" - } else { -#include "parser_sppr_basic_impl.h" - } - } else { - // to do - } - } -} #endif + +#ifdef MACRO_JSON_SHUFFLE +#undef MACRO_JSON_SHUFFLE +#include "parser_sppr_shuffle_impl.h" #else template #if __has_cpp_attribute(__gnu__::__cold__) -- Gitee