Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wjr-z committed Aug 17, 2024
1 parent 98e1846 commit 9943db2
Show file tree
Hide file tree
Showing 88 changed files with 1,970 additions and 1,537 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third-party/atomic"]
path = third-party/atomic
url = https://github.com/boostorg/atomic.git
1 change: 1 addition & 0 deletions atomic
Submodule atomic added at fbdb5f
34 changes: 17 additions & 17 deletions include/wjr/arch/generic/math/bignum-config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,71 @@
#define WJR_GENERIC_MATH_BIGNUM_CONFIG_HPP__

#ifndef WJR_TOOM22_MUL_THRESHOLD
#define WJR_TOOM22_MUL_THRESHOLD 22
#define WJR_TOOM22_MUL_THRESHOLD 22
#endif

#ifndef WJR_TOOM33_MUL_THRESHOLD
#define WJR_TOOM33_MUL_THRESHOLD 84
#define WJR_TOOM33_MUL_THRESHOLD 84
#endif

#ifndef WJR_TOOM44_MUL_THRESHOLD
#define WJR_TOOM44_MUL_THRESHOLD 208
#define WJR_TOOM44_MUL_THRESHOLD 208
#endif

#ifndef WJR_TOOM55_MUL_THRESHOLD
#define WJR_TOOM55_MUL_THRESHOLD 800
#define WJR_TOOM55_MUL_THRESHOLD 800
#endif

#ifndef WJR_TOOM32_TO_TOOM43_MUL_THRESHOLD
#define WJR_TOOM32_TO_TOOM43_MUL_THRESHOLD 73
#define WJR_TOOM32_TO_TOOM43_MUL_THRESHOLD 73
#endif

#ifndef WJR_TOOM32_TO_TOOM53_MUL_THRESHOLD
#define WJR_TOOM32_TO_TOOM53_MUL_THRESHOLD 153
#define WJR_TOOM32_TO_TOOM53_MUL_THRESHOLD 153
#endif

#ifndef WJR_TOOM42_TO_TOOM53_MUL_THRESHOLD
#define WJR_TOOM42_TO_TOOM53_MUL_THRESHOLD 137
#define WJR_TOOM42_TO_TOOM53_MUL_THRESHOLD 137
#endif

#ifndef WJR_TOOM42_TO_TOOM63_MUL_THRESHOLD
#define WJR_TOOM42_TO_TOOM63_MUL_THRESHOLD 153
#define WJR_TOOM42_TO_TOOM63_MUL_THRESHOLD 153
#endif

#ifndef WJR_TOOM2_SQR_THRESHOLD
#define WJR_TOOM2_SQR_THRESHOLD 34
#define WJR_TOOM2_SQR_THRESHOLD 34
#endif

#ifndef WJR_TOOM3_SQR_THRESHOLD
#define WJR_TOOM3_SQR_THRESHOLD 124
#define WJR_TOOM3_SQR_THRESHOLD 124
#endif

#ifndef WJR_TOOM4_SQR_THRESHOLD
#define WJR_TOOM4_SQR_THRESHOLD 288
#define WJR_TOOM4_SQR_THRESHOLD 288
#endif

#ifndef WJR_TOOM5_SQR_THRESHOLD
#define WJR_TOOM5_SQR_THRESHOLD 980
#define WJR_TOOM5_SQR_THRESHOLD 980
#endif

#ifndef WJR_DC_DIV_QR_THRESHOLD
#define WJR_DC_DIV_QR_THRESHOLD (WJR_TOOM22_MUL_THRESHOLD * 2)
#define WJR_DC_DIV_QR_THRESHOLD (WJR_TOOM22_MUL_THRESHOLD * 2)
#endif // WJR_DC_DIV_QR_THRESHOLD

#ifndef WJR_DC_BIGNUM_TO_CHARS_THRESHOLD
#define WJR_DC_BIGNUM_TO_CHARS_THRESHOLD 20
#define WJR_DC_BIGNUM_TO_CHARS_THRESHOLD 20
#endif

#ifndef WJR_DC_BIGNUM_TO_CHARS_PRECOMPUTE_THRESHOLD
#define WJR_DC_BIGNUM_TO_CHARS_PRECOMPUTE_THRESHOLD 20
#define WJR_DC_BIGNUM_TO_CHARS_PRECOMPUTE_THRESHOLD 20
#endif

#ifndef WJR_DC_BIGNUM_FROM_CHARS_THRESHOLD
#define WJR_DC_BIGNUM_FROM_CHARS_THRESHOLD 1670
#define WJR_DC_BIGNUM_FROM_CHARS_THRESHOLD 1670
#endif

#ifndef WJR_DC_BIGNUM_FROM_CHARS_PRECOMPUTE_THRESHOLD
#define WJR_DC_BIGNUM_FROM_CHARS_PRECOMPUTE_THRESHOLD 3105
#define WJR_DC_BIGNUM_FROM_CHARS_PRECOMPUTE_THRESHOLD 3105
#endif

#endif // WJR_GENERIC_MATH_BIGNUM_CONFIG_HPP__
32 changes: 16 additions & 16 deletions include/wjr/arch/x86/container/generic/bplus_tree.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef WJR_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__
#define WJR_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__
#ifndef WJR_ARCH_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__
#define WJR_ARCH_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__

#include <algorithm>

Expand All @@ -8,7 +8,7 @@
namespace wjr {

#if WJR_HAS_SIMD(SSE2)
#define WJR_HAS_BUILTIN_BPLUS_TREE_COPY WJR_HAS_DEF
#define WJR_HAS_BUILTIN_BPLUS_TREE_COPY WJR_HAS_DEF
#endif

#if WJR_HAS_BUILTIN(BPLUS_TREE_COPY)
Expand Down Expand Up @@ -98,12 +98,12 @@ WJR_INTRINSIC_INLINE void __builtin_bplus_tree_copy_impl(const uint8_t *first,
}
}

#if WJR_HAS_SIMD(AVX2)
#if WJR_HAS_SIMD(AVX2)
const auto x0 = avx::loadu(first);
const auto x1 = avx::loadu(last - 32);
avx::storeu(dest, x0);
avx::storeu(dest + n - 32, x1);
#else
#else
const auto x0 = sse::loadu(first);
const auto x1 = sse::loadu(first + 16);
const auto x2 = sse::loadu(last - 32);
Expand All @@ -112,13 +112,13 @@ WJR_INTRINSIC_INLINE void __builtin_bplus_tree_copy_impl(const uint8_t *first,
sse::storeu((dest + 16), x1);
sse::storeu((dest + n - 32), x2);
sse::storeu((dest + n - 16), x3);
#endif
#endif
return;
} while (false);
}

if constexpr (size == 8) {
#if WJR_HAS_SIMD(AVX2)
#if WJR_HAS_SIMD(AVX2)
const auto x0 = avx::loadu(first);
const auto x1 = avx::loadu(first + 32);
const auto x2 = avx::loadu(last - 64);
Expand All @@ -127,7 +127,7 @@ WJR_INTRINSIC_INLINE void __builtin_bplus_tree_copy_impl(const uint8_t *first,
avx::storeu((dest + 32), x1);
avx::storeu((dest + n - 64), x2);
avx::storeu((dest + n - 32), x3);
#else
#else
const auto x0 = sse::loadu(first);
const auto x1 = sse::loadu(first + 16);
const auto x2 = sse::loadu(first + 32);
Expand All @@ -144,7 +144,7 @@ WJR_INTRINSIC_INLINE void __builtin_bplus_tree_copy_impl(const uint8_t *first,
sse::storeu((dest + n - 48), x5);
sse::storeu((dest + n - 32), x6);
sse::storeu((dest + n - 16), x7);
#endif
#endif
}
}

Expand Down Expand Up @@ -241,12 +241,12 @@ __builtin_bplus_tree_copy_backward_impl(const uint8_t *first, const uint8_t *las
}
}

#if WJR_HAS_SIMD(AVX2)
#if WJR_HAS_SIMD(AVX2)
const auto x0 = avx::loadu(first);
const auto x1 = avx::loadu(last - 32);
avx::storeu((dest - n), x0);
avx::storeu((dest - 32), x1);
#else
#else
const auto x0 = sse::loadu(first);
const auto x1 = sse::loadu(first + 16);
const auto x2 = sse::loadu(last - 32);
Expand All @@ -255,13 +255,13 @@ __builtin_bplus_tree_copy_backward_impl(const uint8_t *first, const uint8_t *las
sse::storeu((dest - n + 16), x1);
sse::storeu((dest - 32), x2);
sse::storeu((dest - 16), x3);
#endif
#endif
return;
} while (false);
}

if constexpr (size == 8) {
#if WJR_HAS_SIMD(AVX2)
#if WJR_HAS_SIMD(AVX2)
const auto x0 = avx::loadu(first);
const auto x1 = avx::loadu(first + 32);
const auto x2 = avx::loadu(last - 64);
Expand All @@ -270,7 +270,7 @@ __builtin_bplus_tree_copy_backward_impl(const uint8_t *first, const uint8_t *las
avx::storeu((dest - n + 32), x1);
avx::storeu((dest - 64), x2);
avx::storeu((dest - 32), x3);
#else
#else
const auto x0 = sse::loadu(first);
const auto x1 = sse::loadu(first + 16);
const auto x2 = sse::loadu(first + 32);
Expand All @@ -287,7 +287,7 @@ __builtin_bplus_tree_copy_backward_impl(const uint8_t *first, const uint8_t *las
sse::storeu((dest - 48), x5);
sse::storeu((dest - 32), x6);
sse::storeu((dest - 16), x7);
#endif
#endif
}
}

Expand All @@ -304,4 +304,4 @@ WJR_INTRINSIC_INLINE void builtin_bplus_tree_copy_backward(const Other *first,

} // namespace wjr

#endif // WJR_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__
#endif // WJR_ARCH_X86_CONTAINER_GENERIC_BPLUS_TREE_HPP__
18 changes: 9 additions & 9 deletions include/wjr/arch/x86/format/charconv.hpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#ifndef WJR_X86_FORMAT_CHARCONV_HPP__
#define WJR_X86_FORMAT_CHARCONV_HPP__
#ifndef WJR_ARCH_X86_FORMAT_CHARCONV_HPP__
#define WJR_ARCH_X86_FORMAT_CHARCONV_HPP__

#include <wjr/format/charconv-impl.hpp>
#include <wjr/arch/x86/simd/simd.hpp>
#include <wjr/format/charconv-impl.hpp>

#ifndef WJR_X86
#error "x86 required"
#error "x86 required"
#endif

namespace wjr {

#if WJR_HAS_SIMD(SSE4_1)
#define WJR_HAS_BUILTIN_TO_CHARS_UNROLL_8_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_TO_CHARS_UNROLL_8_FAST WJR_HAS_DEF

#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_4_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_8_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_16_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_4_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_8_FAST WJR_HAS_DEF
#define WJR_HAS_BUILTIN_FROM_CHARS_UNROLL_16_FAST WJR_HAS_DEF
#endif

#if WJR_HAS_BUILTIN(TO_CHARS_UNROLL_8_FAST)
Expand Down Expand Up @@ -194,4 +194,4 @@ uint64_t builtin_from_chars_unroll_16_fast(const void *ptr, origin_converter_t)

} // namespace wjr

#endif // WJR_X86_FORMAT_CHARCONV_HPP__
#endif // WJR_ARCH_X86_FORMAT_CHARCONV_HPP__
6 changes: 3 additions & 3 deletions include/wjr/arch/x86/format/utf8/utf8.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef WJR_X86_FORMAT_UTF8_HPP__
#define WJR_X86_FORMAT_UTF8_HPP__
#ifndef WJR_ARCH_X86_FORMAT_UTF8_HPP__
#define WJR_ARCH_X86_FORMAT_UTF8_HPP__

#include <wjr/arch/x86/simd/simd.hpp>

namespace wjr::utf8 {} // namespace wjr::utf8

#endif // WJR_X86_FORMAT_UTF8_HPP__
#endif // WJR_ARCH_X86_FORMAT_UTF8_HPP__
10 changes: 5 additions & 5 deletions include/wjr/arch/x86/json/lexer.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef WJR_X86_JSON_LEXER_HPP__
#define WJR_X86_JSON_LEXER_HPP__
#ifndef WJR_ARCH_X86_JSON_LEXER_HPP__
#define WJR_ARCH_X86_JSON_LEXER_HPP__

#include <wjr/arch/x86/simd/simd.hpp>

#if WJR_HAS_SIMD(SSSE3)
#define WJR_HAS_BUILTIN_JSON_LEXER_READER_READ_BUF WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_MINIFY_BUF WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_LEXER_READER_READ_BUF WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_MINIFY_BUF WJR_HAS_DEF
#endif

#endif // WJR_X86_JSON_LEXER_HPP__
#endif // WJR_ARCH_X86_JSON_LEXER_HPP__
10 changes: 5 additions & 5 deletions include/wjr/arch/x86/json/string.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef WJR_X86_JSON_STRING_HPP__
#define WJR_X86_JSON_STRING_HPP__
#ifndef WJR_ARCH_X86_JSON_STRING_HPP__
#define WJR_ARCH_X86_JSON_STRING_HPP__

#include <wjr/arch/x86/simd/simd.hpp>

#if WJR_HAS_SIMD(SSE2)
#define WJR_HAS_BUILTIN_JSON_PARSE_STRING WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_CHECK_STRING WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_PARSE_STRING WJR_HAS_DEF
#define WJR_HAS_BUILTIN_JSON_CHECK_STRING WJR_HAS_DEF
#endif

#endif // WJR_X86_JSON_STRING_HPP__
#endif // WJR_ARCH_X86_JSON_STRING_HPP__
Loading

0 comments on commit 9943db2

Please sign in to comment.