Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v18.x backport] test_runner various features #46360

Closed
Closed
Changes from 1 commit
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
57e9ab1
test: split parallel fs-watch-recursive tests
anonrig Dec 20, 2022
b6965b0
src: check size of args before using for exec_path
awilfox Dec 20, 2022
7ef5086
src: fix UB in overflow checks
bnoordhuis Dec 20, 2022
972c25a
doc: fix wrong output of example in `url.password`
deokjinkim Dec 21, 2022
5d6d8aa
benchmark: include webstreams benchmark
RafaelGSS Dec 21, 2022
b7c0e7e
build: add option to disable shared readonly heap
addaleax Dec 21, 2022
94c8fdd
os: add availableParallelism()
cjihrig Dec 17, 2022
74f4e23
doc: add parallelism note to os.cpus()
cjihrig Dec 18, 2022
0344dce
src: use string_view for FastStringKey implementation
addaleax Dec 21, 2022
e23ab5d
deps: add simdutf dependency
anonrig Nov 30, 2022
96fc1ca
util: add fast path for text-decoder fatal flag
anonrig Dec 15, 2022
dac0f2e
deps: disable avx512 for simutf on benchmark ci
anonrig Dec 17, 2022
837d481
errors: refactor to use a method that formats a list string
daeyeon Dec 23, 2022
73d6fbf
src: fix creating `Isolate`s from addons
addaleax Dec 23, 2022
6539fb2
meta: add `nodejs/test_runner` to CODEOWNERS
aduh95 Dec 23, 2022
d08c762
tools: update GitHub workflow action
VoltrexKeyva Dec 23, 2022
fd6e74e
doc: show output of example in http
deokjinkim Dec 24, 2022
f3a7417
meta: add `nodejs/loaders` to CODEOWNERS
GeoffreyBooth Dec 24, 2022
85202f5
doc: remove port from example in `url.hostname`
deokjinkim Dec 24, 2022
ac649a7
http: improved timeout defaults handling
ShogunPanda Dec 24, 2022
1128a61
doc: fix typos in packages.md
ericmutta Dec 23, 2022
9a7f22d
doc: update error message of example in repl
deokjinkim Dec 24, 2022
cdcd16d
build: fix arm64 cross-compile from powershell
StefanStojanovic Dec 24, 2022
cb767a2
Revert "deps: disable avx512 for simutf on benchmark ci"
anonrig Dec 24, 2022
907068c
buffer: add buffer.isUtf8 for utf8 validation
anonrig Dec 25, 2022
e838349
process,worker: ensure code after exit() effectless
ywave620 Dec 25, 2022
189d05a
doc: replace single executable champion in strategic initiatives doc
RaisinTen Dec 25, 2022
b7ac379
deps: fix updater github workflow job
anonrig Dec 25, 2022
e9b1879
test: print failed JS/parallel tests
GeoffreyBooth Dec 27, 2022
3cfb158
tools: update lint-md-dependencies to [email protected]
nodejs-github-bot Dec 27, 2022
00c36f4
meta: update AUTHORS
nodejs-github-bot Dec 27, 2022
cbff206
deps: update to uvwasi 0.0.14
cjihrig Dec 27, 2022
d4471bf
tools: add url to `AUTHORS` update automation
aduh95 Dec 27, 2022
7c73783
doc: make EventEmitterAsyncResource's `options` as optional
deokjinkim Dec 27, 2022
4041af3
deps: update simdutf to 2.0.9
nodejs-github-bot Dec 27, 2022
4cbb830
http: replace `var` with `const` on code of comment
deokjinkim Dec 28, 2022
6cde457
doc: use `os.availableParallelism()` in async_context and cluster
deokjinkim Dec 28, 2022
34f3912
debugger: refactor console in lib/internal/debugger/inspect.js
debadree25 Dec 28, 2022
ef7f7b2
src: fix crash on OnStreamRead on Windows
santigimeno Dec 28, 2022
2c9b8c5
stream: fix typo in JSDoc
deokjinkim Dec 28, 2022
bdd1b03
doc: fix wrong output of example in `url.protocol`
deokjinkim Dec 28, 2022
6a74b8a
src: fix typo in `node_file.cc`
kwarabei Dec 28, 2022
6e2f118
lib: use `kEmptyObject` as default value for options
deokjinkim Dec 31, 2022
e33ceac
esm: rewrite loader hooks test
GeoffreyBooth Dec 31, 2022
160c26a
stream: refactor to use `validateFunction`
deokjinkim Jan 1, 2023
bf6585c
fs: refactor to use `validateInteger`
deokjinkim Jan 1, 2023
da86e43
doc: use console.error for error case in timers and tls
deokjinkim Jan 1, 2023
11cd248
async_hooks: refactor to use `validateObject`
deokjinkim Jan 1, 2023
d46f974
vm: refactor to use `validateStringArray`
deokjinkim Jan 1, 2023
b489b13
events: fix violation of symbol naming convention
deokjinkim Jan 1, 2023
a7ab63c
test: use `process.hrtime.bigint` instead of `process.hrtime`
deokjinkim Jan 1, 2023
655f9ee
lib: update JSDoc of `getOwnPropertyValueOrDefault`
deokjinkim Jan 1, 2023
638a516
tools: add release host var to promotion script
ruyadorno Jan 1, 2023
5b83bb7
doc: update isUtf8 description
anonrig Jan 1, 2023
eb94b55
tools: update doc to [email protected]
nodejs-github-bot Jan 1, 2023
1d95e9c
tools: update lint-md-dependencies to [email protected]
nodejs-github-bot Jan 1, 2023
1ac1894
meta: update AUTHORS
nodejs-github-bot Jan 1, 2023
d83f7ee
crypto: ensure exported webcrypto EC keys use uncompressed point format
bnoordhuis Dec 30, 2022
f6cd0dc
net: handle socket.write(cb) edge case
santigimeno Jan 1, 2023
4330e35
deps: update corepack to 0.15.3
nodejs-github-bot Jan 2, 2023
eb52663
dgram: sync the old handle state to new handle
theanarkh Jan 3, 2023
e6130a2
src: speed up process.getActiveResourcesInfo()
RaisinTen Jan 3, 2023
c3d6c1d
http: join authorization headers
marco-ippolito Jan 3, 2023
2ebe3d9
crypto: add KeyObject Symbol.toStringTag
panva Jan 3, 2023
ce5d484
tools: fix lint rule recommendation
cjihrig Jan 1, 2023
d790028
lib: fix incorrect use of console intrinsic
cjihrig Jan 1, 2023
c0e7738
node-api: disambiguate napi_add_finalizer
legendecas Nov 10, 2022
de0d282
test,esm: validate more edge cases for dynamic imports
aduh95 Jan 4, 2023
6d2f862
doc: describe argument of `Symbol.for`
deokjinkim Jan 4, 2023
08a9bf8
meta: update comment in `CODEOWNERS` to better reflect current policy
aduh95 Jan 6, 2023
7dcc80c
tools: make update-eslint.sh work with npm@9
lpinca Jan 4, 2023
9d43491
tools: move update-eslint.sh to dep_updaters/
lpinca Jan 4, 2023
a7174a3
doc: include updating release optional step
RafaelGSS Jan 6, 2023
dabc05b
doc: mention how to run ncu-ci citgm
RafaelGSS Jan 6, 2023
032e680
doc: add personal pronouns option
panva Jan 6, 2023
9505c38
src: keep PipeWrap::Open function consistent with TCPWrap
theanarkh Jan 6, 2023
de09c54
doc: fix `event.cancelBubble` documentation
deokjinkim Jan 7, 2023
ee1c2a6
doc: abort controller emits error in child process
debadree25 Jan 7, 2023
5dc3cf8
doc,crypto: fix WebCryptoAPI import keyData and export return
panva Jan 7, 2023
901b51d
src: fix typo in node_snapshotable.cc
kwarabei Jan 7, 2023
a47522c
events: change status of `event.srcElement` to legacy
deokjinkim Jan 7, 2023
1d0b562
crypto: return correct bit length in KeyObject's asymmetricKeyDetails
panva Jan 7, 2023
cf16b40
module: fix unintended mutation
aduh95 Jan 7, 2023
713a8c9
doc: fix spelling in SECURITY.md
vchan-in Jan 7, 2023
0c074dc
assert: remove `assert.snapshot`
MoLow Jan 7, 2023
221fcfe
doc: fix ERR_TLS_RENEGOTIATION_DISABLED text
tniessen Jan 7, 2023
e06ed89
meta: update AUTHORS
nodejs-github-bot Jan 8, 2023
302175f
doc: fix (EC)DHE remark in TLS docs
tniessen Jan 8, 2023
010098b
deps: update simdutf to 2.1.0
nodejs-github-bot Jan 8, 2023
cea44d8
test: add test to once() in event lib
jdiaz-dev Jan 9, 2023
39662eb
src: use constant strings for memory info names
legendecas Jan 9, 2023
88c934f
tools: update lint-md-dependencies to [email protected]
nodejs-github-bot Jan 10, 2023
64a7016
src: use simdutf for converting externalized builtins to UTF-16
addaleax Jan 10, 2023
6df6543
deps: add simdutf version to metadata
roth-mike Jan 10, 2023
0d787a1
doc: remove outdated sections from `maintaining-v8`
aduh95 Jan 10, 2023
d9a6e68
tools: update eslint to 8.31.0
nodejs-github-bot Jan 10, 2023
ce9ab00
test: update Web Events WPT
deokjinkim Jan 10, 2023
0453811
perf_hooks: fix checking range of `options.figures` in createHistogram
deokjinkim Jan 10, 2023
91f5625
doc: duplex and readable from uncaught execption warning
marco-ippolito Jan 11, 2023
4ac006d
events: change status of `event.cancelBubble` to legacy
deokjinkim Jan 11, 2023
94c07d3
deps: add /deps/**/.github/ to .gitignore
lpinca Jan 11, 2023
c630a53
doc: add PerformanceObserver.supportedEntryTypes to doc
theanarkh Jan 11, 2023
0009faa
test: use `os.availableParallelism()`
deokjinkim Dec 29, 2022
b3802b2
benchmark,tools: use os.availableParallelism()
deokjinkim Jan 2, 2023
2a7179e
lib: reuse invalid state errors on webstreams
RafaelGSS Jan 13, 2023
6bb512c
src: remove unnecessary semicolons
codebytere Jan 13, 2023
8706545
doc: make options of readableStream.pipeTo as optional
deokjinkim Jan 13, 2023
fdd5fa4
doc: https update default request timeout
marco-ippolito Jan 13, 2023
225008f
tools: update create-or-update-pull-request-action
targos Jan 13, 2023
f20bab0
src: remove return after abort
codebytere Jan 13, 2023
f7a4cce
http: refactor to use min of validateNumber for maxTotalSockets
deokjinkim Jan 13, 2023
24f2aae
vm: refactor to use validate function
deokjinkim Jan 14, 2023
4e54f85
doc: use "file system" instead of "filesystem"
Trott Jan 14, 2023
36f63d7
tools: add automation for updating postject dependency
RaisinTen Jan 14, 2023
7d899c2
lib: refactor to use validate function
deokjinkim Jan 14, 2023
7768f03
src: distinguish env stopping flags
legendecas Jan 14, 2023
bc58629
crypto: ensure auth tag set for chacha20-poly1305
bnoordhuis Jan 14, 2023
852dc6c
doc: update http.setMaxIdleHTTPParsers arguments
debadree25 Jan 14, 2023
fbc7a02
deps: bump googletest to 2023.01.13
gengjiawen Jan 15, 2023
e28937e
tools: fix macro name in update-undici
almeidx Jan 15, 2023
5c3e7df
tools: update lint-md-dependencies
nodejs-github-bot Jan 15, 2023
090c6c7
meta: update AUTHORS
nodejs-github-bot Jan 15, 2023
574a850
doc: add Node-API media link
KevinEady Jan 15, 2023
6ccf192
lib: use kEmptyObject and update JSDoc in webstreams
deokjinkim Jan 15, 2023
c7abebf
src: hide kMaxDigestMultiplier outside HKDF impl
tniessen Jan 16, 2023
aebdef8
src,lib: the handle keeps loop alive in cluster rr mode
theanarkh Jan 16, 2023
133bf63
doc: update to match changed `--dns-result-order` default
tikotzky Jan 16, 2023
6c8a26c
build: add extra semi check
gengjiawen Jan 13, 2023
ca6adb1
deps: cherrypick simdutf patch
gengjiawen Jan 16, 2023
5666b08
deps: upgrade npm to 9.3.0
npm-cli-bot Jan 17, 2023
aa1cb80
http: writeHead if statusmessage is undefined dont override headers
marco-ippolito Jan 17, 2023
f800be5
src: replace unreachable code with static_assert
tniessen Jan 17, 2023
f670a54
http: refactor to use `validateHeaderName`
deokjinkim Jan 17, 2023
c14f068
esm: mark `importAssertions` as required
aduh95 Jan 12, 2023
af04a4b
doc: add text around collaborative expectations
mhdawson Jan 6, 2023
5f6aab3
crypto: add cipher update/final methods encoding validation
vitpavlenko Jan 17, 2023
ec6f1e9
doc: add note to tls docs about secureContext availability
tgerk Jan 18, 2023
c1f2c8d
test: add fix so that test exits if port 42 is unprivileged
7suyash7 Jan 18, 2023
e518ca8
stream: implement finished() for ReadableStream and WritableStream
debadree25 Jan 18, 2023
bb6e47d
deps: upgrade npm to 9.3.1
npm-cli-bot Jan 18, 2023
8166ff9
crypto: add CryptoKey Symbol.toStringTag
panva Jan 18, 2023
c3dcb94
doc: update events API example to have runnable code
deokjinkim Jan 18, 2023
cbfd076
test: improve test coverage for WHATWG `TextDecoder`
juanarbol Jan 18, 2023
594d638
deps: update simdutf to 3.1.0
nodejs-github-bot Jan 18, 2023
3536efe
src: fix endianness of simdutf
anonrig Jan 18, 2023
2e0f047
test: refactor to avoid mutation of global by a loader
targos Jan 19, 2023
de3c430
events: change status of `event.returnvalue` to legacy
deokjinkim Jan 19, 2023
b6a0922
trace_events: refactor to use `validateStringArray`
deokjinkim Jan 19, 2023
f217492
stream: fix pipeline calling end on destination more than once
debadree25 Jan 19, 2023
2537d33
doc: fix mismatched arguments of `NodeEventTarget`
deokjinkim Jan 19, 2023
1287031
test: update postject to 1.0.0-alpha.4
nodejs-github-bot Jan 14, 2023
53d8bf8
test_runner: avoid swallowing of asynchronously thrown errors
fossamagna Nov 7, 2022
a1d1df2
test_runner: add reporters
MoLow Dec 19, 2022
7ad6b73
module: move test reporter loading
GeoffreyBooth Dec 22, 2022
d90d1b3
test_runner: report `file` in test runner events
MoLow Jan 2, 2023
e304cc5
test_runner: make built in reporters internal
cjihrig Jan 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deps: update simdutf to 2.1.0
PR-URL: #46128
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
nodejs-github-bot authored and juanarbol committed Jan 25, 2023
commit 010098b55a772794aa6460fff67e61a8e2374c3b
846 changes: 466 additions & 380 deletions deps/simdutf/simdutf.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2022-12-15 12:13:17 -0500. Do not edit! */
/* auto-generated on 2023-01-02 15:43:33 -0500. Do not edit! */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf.cpp
/* begin file src/simdutf.cpp */
#include "simdutf.h"
@@ -25,6 +25,7 @@ std::string toBinaryString(T b) {
}

// Implementations
// The best choice should always come first!
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/arm64.h
/* begin file src/simdutf/arm64.h */
#ifndef SIMDUTF_ARM64_H
@@ -1104,6 +1105,313 @@ simdutf_really_inline simd16<int16_t>::operator simd16<uint16_t>() const { retur

#endif // SIMDUTF_ARM64_H
/* end file src/simdutf/arm64.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake.h
/* begin file src/simdutf/icelake.h */
#ifndef SIMDUTF_ICELAKE_H
#define SIMDUTF_ICELAKE_H



#ifdef __has_include
// How do we detect that a compiler supports vbmi2?
// For sure if the following header is found, we are ok?
#if __has_include(<avx512vbmi2intrin.h>)
#define SIMDUTF_COMPILER_SUPPORTS_VBMI2 1
#endif
#endif

#ifdef _MSC_VER
#if _MSC_VER >= 1920
// Visual Studio 2019 and up support VBMI2 under x64 even if the header
// avx512vbmi2intrin.h is not found.
#define SIMDUTF_COMPILER_SUPPORTS_VBMI2 1
#endif
#endif

// We allow icelake on x64 as long as the compiler is known to support VBMI2.
#ifndef SIMDUTF_IMPLEMENTATION_ICELAKE
#define SIMDUTF_IMPLEMENTATION_ICELAKE ((SIMDUTF_IS_X86_64) && (SIMDUTF_COMPILER_SUPPORTS_VBMI2))
#endif

// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
// https://github.com/simdutf/simdutf/issues/1247
#define SIMDUTF_CAN_ALWAYS_RUN_ICELAKE ((SIMDUTF_IMPLEMENTATION_ICELAKE) && (SIMDUTF_IS_X86_64) && (__AVX2__) && (SIMDUTF_HAS_AVX512F && \
SIMDUTF_HAS_AVX512DQ && \
SIMDUTF_HAS_AVX512VL && \
SIMDUTF_HAS_AVX512VBMI2) && (!SIMDUTF_IS_32BITS))

#if SIMDUTF_IMPLEMENTATION_ICELAKE
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
#define SIMDUTF_TARGET_ICELAKE
#else
#define SIMDUTF_TARGET_ICELAKE SIMDUTF_TARGET_REGION("avx512f,avx512dq,avx512cd,avx512bw,avx512vbmi,avx512vbmi2,avx512vl,avx2,bmi,bmi2,pclmul,lzcnt")
#endif

namespace simdutf {
namespace icelake {
} // namespace icelake
} // namespace simdutf



//
// These two need to be included outside SIMDUTF_TARGET_REGION
//
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/intrinsics.h
/* begin file src/simdutf/icelake/intrinsics.h */
#ifndef SIMDUTF_ICELAKE_INTRINSICS_H
#define SIMDUTF_ICELAKE_INTRINSICS_H


#ifdef SIMDUTF_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
#include <intrin.h> // visual studio or clang
#include <immintrin.h>
#else

#if SIMDUTF_GCC11ORMORE
// We should not get warnings while including <x86intrin.h> yet we do
// under some versions of GCC.
// If the x86intrin.h header has uninitialized values that are problematic,
// it is a GCC issue, we want to ignore these warnigns.
SIMDUTF_DISABLE_GCC_WARNING(-Wuninitialized)
#endif

#include <x86intrin.h> // elsewhere


#if SIMDUTF_GCC11ORMORE
// cancels the suppression of the -Wuninitialized
SIMDUTF_POP_DISABLE_WARNINGS
#endif

#ifndef _tzcnt_u64
#define _tzcnt_u64(x) __tzcnt_u64(x)
#endif // _tzcnt_u64
#endif // SIMDUTF_VISUAL_STUDIO

#ifdef SIMDUTF_CLANG_VISUAL_STUDIO
/**
* You are not supposed, normally, to include these
* headers directly. Instead you should either include intrin.h
* or x86intrin.h. However, when compiling with clang
* under Windows (i.e., when _MSC_VER is set), these headers
* only get included *if* the corresponding features are detected
* from macros:
* e.g., if __AVX2__ is set... in turn, we normally set these
* macros by compiling against the corresponding architecture
* (e.g., arch:AVX2, -mavx2, etc.) which compiles the whole
* software with these advanced instructions. In simdutf, we
* want to compile the whole program for a generic target,
* and only target our specific kernels. As a workaround,
* we directly include the needed headers. These headers would
* normally guard against such usage, but we carefully included
* <x86intrin.h> (or <intrin.h>) before, so the headers
* are fooled.
*/
#include <bmiintrin.h> // for _blsr_u64
#include <bmi2intrin.h> // for _pext_u64, _pdep_u64
#include <lzcntintrin.h> // for __lzcnt64
#include <immintrin.h> // for most things (AVX2, AVX512, _popcnt64)
#include <smmintrin.h>
#include <tmmintrin.h>
#include <avxintrin.h>
#include <avx2intrin.h>
#include <wmmintrin.h> // for _mm_clmulepi64_si128
// Important: we need the AVX-512 headers:
#include <avx512fintrin.h>
#include <avx512dqintrin.h>
#include <avx512cdintrin.h>
#include <avx512bwintrin.h>
#include <avx512vlintrin.h>
#include <avx512vlbwintrin.h>
#include <avx512vbmiintrin.h>
#include <avx512vbmi2intrin.h>
// unfortunately, we may not get _blsr_u64, but, thankfully, clang
// has it as a macro.
#ifndef _blsr_u64
// we roll our own
#define _blsr_u64(n) ((n - 1) & n)
#endif // _blsr_u64
#endif // SIMDUTF_CLANG_VISUAL_STUDIO



#if defined(__GNUC__) && !defined(__clang__)

#if __GNUC__ == 8
#define SIMDUTF_GCC8 1
#elif __GNUC__ == 9
#define SIMDUTF_GCC9 1
#endif // __GNUC__ == 8 || __GNUC__ == 9

#endif // defined(__GNUC__) && !defined(__clang__)

#if SIMDUTF_GCC8
#pragma GCC push_options
#pragma GCC target("avx512f")
/**
* GCC 8 fails to provide _mm512_set_epi8. We roll our own.
*/
inline __m512i _mm512_set_epi8(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18, uint8_t a19, uint8_t a20, uint8_t a21, uint8_t a22, uint8_t a23, uint8_t a24, uint8_t a25, uint8_t a26, uint8_t a27, uint8_t a28, uint8_t a29, uint8_t a30, uint8_t a31, uint8_t a32, uint8_t a33, uint8_t a34, uint8_t a35, uint8_t a36, uint8_t a37, uint8_t a38, uint8_t a39, uint8_t a40, uint8_t a41, uint8_t a42, uint8_t a43, uint8_t a44, uint8_t a45, uint8_t a46, uint8_t a47, uint8_t a48, uint8_t a49, uint8_t a50, uint8_t a51, uint8_t a52, uint8_t a53, uint8_t a54, uint8_t a55, uint8_t a56, uint8_t a57, uint8_t a58, uint8_t a59, uint8_t a60, uint8_t a61, uint8_t a62, uint8_t a63) {
return _mm512_set_epi64(uint64_t(a7) + (uint64_t(a6) << 8) + (uint64_t(a5) << 16) + (uint64_t(a4) << 24) + (uint64_t(a3) << 32) + (uint64_t(a2) << 40) + (uint64_t(a1) << 48) + (uint64_t(a0) << 56),
uint64_t(a15) + (uint64_t(a14) << 8) + (uint64_t(a13) << 16) + (uint64_t(a12) << 24) + (uint64_t(a11) << 32) + (uint64_t(a10) << 40) + (uint64_t(a9) << 48) + (uint64_t(a8) << 56),
uint64_t(a23) + (uint64_t(a22) << 8) + (uint64_t(a21) << 16) + (uint64_t(a20) << 24) + (uint64_t(a19) << 32) + (uint64_t(a18) << 40) + (uint64_t(a17) << 48) + (uint64_t(a16) << 56),
uint64_t(a31) + (uint64_t(a30) << 8) + (uint64_t(a29) << 16) + (uint64_t(a28) << 24) + (uint64_t(a27) << 32) + (uint64_t(a26) << 40) + (uint64_t(a25) << 48) + (uint64_t(a24) << 56),
uint64_t(a39) + (uint64_t(a38) << 8) + (uint64_t(a37) << 16) + (uint64_t(a36) << 24) + (uint64_t(a35) << 32) + (uint64_t(a34) << 40) + (uint64_t(a33) << 48) + (uint64_t(a32) << 56),
uint64_t(a47) + (uint64_t(a46) << 8) + (uint64_t(a45) << 16) + (uint64_t(a44) << 24) + (uint64_t(a43) << 32) + (uint64_t(a42) << 40) + (uint64_t(a41) << 48) + (uint64_t(a40) << 56),
uint64_t(a55) + (uint64_t(a54) << 8) + (uint64_t(a53) << 16) + (uint64_t(a52) << 24) + (uint64_t(a51) << 32) + (uint64_t(a50) << 40) + (uint64_t(a49) << 48) + (uint64_t(a48) << 56),
uint64_t(a63) + (uint64_t(a62) << 8) + (uint64_t(a61) << 16) + (uint64_t(a60) << 24) + (uint64_t(a59) << 32) + (uint64_t(a58) << 40) + (uint64_t(a57) << 48) + (uint64_t(a56) << 56));
}
#pragma GCC pop_options
#endif // SIMDUTF_GCC8

#endif // SIMDUTF_HASWELL_INTRINSICS_H
/* end file src/simdutf/icelake/intrinsics.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/implementation.h
/* begin file src/simdutf/icelake/implementation.h */
#ifndef SIMDUTF_ICELAKE_IMPLEMENTATION_H
#define SIMDUTF_ICELAKE_IMPLEMENTATION_H


namespace simdutf {
namespace icelake {

namespace {
using namespace simdutf;
}

class implementation final : public simdutf::implementation {
public:
simdutf_really_inline implementation() : simdutf::implementation(
"icelake",
"Intel AVX512 (AVX-512BW, AVX-512CD, AVX-512VL, AVX-512VBMI2 extensions)",
internal::instruction_set::AVX2 | internal::instruction_set::PCLMULQDQ | internal::instruction_set::BMI1 | internal::instruction_set::BMI2 | internal::instruction_set::AVX512BW | internal::instruction_set::AVX512CD | internal::instruction_set::AVX512VL | internal::instruction_set::AVX512VBMI2 ) {}
simdutf_warn_unused int detect_encodings(const char * input, size_t length) const noexcept final;
simdutf_warn_unused bool validate_utf8(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf8_with_errors(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_ascii(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_ascii_with_errors(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf16le(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf16be(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf16le_with_errors(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf16be_with_errors(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf32(const char32_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf32_with_errors(const char32_t *buf, size_t len) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf16le(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf16be(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf16le_with_errors(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf16be_with_errors(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf16le(const char * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf16be(const char * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf32(const char * buf, size_t len, char32_t* utf32_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf32_with_errors(const char * buf, size_t len, char32_t* utf32_output) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf32(const char * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16le_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16be_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16le_to_utf8_with_errors(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16be_to_utf8_with_errors(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16le_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16be_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf8(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf8_with_errors(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf8(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf16le(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf16be(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf16le_with_errors(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf16be_with_errors(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf16le(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf16be(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16le_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16be_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16le_to_utf32_with_errors(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16be_to_utf32_with_errors(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16le_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16be_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
void change_endianness_utf16(const char16_t * buf, size_t length, char16_t * output) const noexcept final;
simdutf_warn_unused size_t count_utf16le(const char16_t * buf, size_t length) const noexcept;
simdutf_warn_unused size_t count_utf16be(const char16_t * buf, size_t length) const noexcept;
simdutf_warn_unused size_t count_utf8(const char * buf, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf16le(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf16be(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf16le(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf16be(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf16_length_from_utf8(const char * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf32(const char32_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf16_length_from_utf32(const char32_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf8(const char * input, size_t length) const noexcept;
};

} // namespace icelake
} // namespace simdutf

#endif // SIMDUTF_ICELAKE_IMPLEMENTATION_H
/* end file src/simdutf/icelake/implementation.h */

//
// The rest need to be inside the region
//
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/begin.h
/* begin file src/simdutf/icelake/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "icelake"
// #define SIMDUTF_IMPLEMENTATION icelake

#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
// nothing needed.
#else
SIMDUTF_TARGET_ICELAKE
#endif

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_DISABLE_GCC_WARNING(-Wmaybe-uninitialized)
#endif // end of workaround
/* end file src/simdutf/icelake/begin.h */
// Declarations
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/bitmanipulation.h
/* begin file src/simdutf/icelake/bitmanipulation.h */
#ifndef SIMDUTF_ICELAKE_BITMANIPULATION_H
#define SIMDUTF_ICELAKE_BITMANIPULATION_H

namespace simdutf {
namespace icelake {
namespace {

#ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
simdutf_really_inline unsigned __int64 count_ones(uint64_t input_num) {
// note: we do not support legacy 32-bit Windows
return __popcnt64(input_num);// Visual Studio wants two underscores
}
#else
simdutf_really_inline long long int count_ones(uint64_t input_num) {
return _popcnt64(input_num);
}
#endif

} // unnamed namespace
} // namespace icelake
} // namespace simdutf

#endif // SIMDUTF_ICELAKE_BITMANIPULATION_H
/* end file src/simdutf/icelake/bitmanipulation.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/end.h
/* begin file src/simdutf/icelake/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif


#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_POP_DISABLE_WARNINGS
#endif // end of workaround
/* end file src/simdutf/icelake/end.h */



#endif // SIMDUTF_IMPLEMENTATION_ICELAKE
#endif // SIMDUTF_ICELAKE_H
/* end file src/simdutf/icelake.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/haswell.h
/* begin file src/simdutf/haswell.h */
#ifndef SIMDUTF_HASWELL_H
@@ -1124,7 +1432,12 @@ simdutf_really_inline simd16<int16_t>::operator simd16<uint16_t>() const { retur
// You do not want to restrict it like so: SIMDUTF_IS_X86_64 && __AVX2__
// because we want to rely on *runtime dispatch*.
//
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
#define SIMDUTF_IMPLEMENTATION_HASWELL 0
#else
#define SIMDUTF_IMPLEMENTATION_HASWELL (SIMDUTF_IS_X86_64)
#endif

#endif
// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
// https://github.com/simdutf/simdutf/issues/1247
@@ -1298,8 +1611,12 @@ SIMDUTF_POP_DISABLE_WARNINGS
/* begin file src/simdutf/haswell/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "haswell"
// #define SIMDUTF_IMPLEMENTATION haswell
SIMDUTF_TARGET_HASWELL

#if SIMDUTF_CAN_ALWAYS_RUN_HASWELL
// nothing needed.
#else
SIMDUTF_TARGET_HASWELL
#endif

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_DISABLE_GCC_WARNING(-Wmaybe-uninitialized)
@@ -2010,10 +2327,15 @@ struct simd16<uint16_t>: base16_numeric<uint16_t> {

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/haswell/end.h
/* begin file src/simdutf/haswell/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_HASWELL
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif


#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
#pragma GCC diagnostic pop
SIMDUTF_POP_DISABLE_WARNINGS
#endif // end of workaround
/* end file src/simdutf/haswell/end.h */

@@ -2036,8 +2358,14 @@ SIMDUTF_UNTARGET_REGION
// You do not want to set it to (SIMDUTF_IS_X86_64 && !SIMDUTF_REQUIRES_HASWELL)
// because you want to rely on runtime dispatch!
//
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE || SIMDUTF_CAN_ALWAYS_RUN_HASWELL
#define SIMDUTF_IMPLEMENTATION_WESTMERE 0
#else
#define SIMDUTF_IMPLEMENTATION_WESTMERE (SIMDUTF_IS_X86_64)
#endif

#endif

#define SIMDUTF_CAN_ALWAYS_RUN_WESTMERE (SIMDUTF_IMPLEMENTATION_WESTMERE && SIMDUTF_IS_X86_64 && __SSE4_2__ && __PCLMUL__)

#if SIMDUTF_IMPLEMENTATION_WESTMERE
@@ -2186,7 +2514,12 @@ SIMDUTF_POP_DISABLE_WARNINGS
/* begin file src/simdutf/westmere/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "westmere"
// #define SIMDUTF_IMPLEMENTATION westmere

#if SIMDUTF_CAN_ALWAYS_RUN_WESTMERE
// nothing needed.
#else
SIMDUTF_TARGET_WESTMERE
#endif
/* end file src/simdutf/westmere/begin.h */

// Declarations
@@ -2939,7 +3272,12 @@ template<typename T>

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/westmere/end.h
/* begin file src/simdutf/westmere/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_WESTMERE
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif

/* end file src/simdutf/westmere/end.h */

#endif // SIMDUTF_IMPLEMENTATION_WESTMERE
@@ -3582,354 +3920,66 @@ template <typename T> struct simd8x64 {
const simd8<uint8_t> mask = simd8<uint8_t>::splat(m);
return simd8x64<bool>(
simd8<uint8_t>(this->chunks[0]) >= mask,
simd8<uint8_t>(this->chunks[1]) >= mask,
simd8<uint8_t>(this->chunks[2]) >= mask,
simd8<uint8_t>(this->chunks[3]) >= mask
).to_bitmask();
}
}; // struct simd8x64<T>

} // namespace simd
} // unnamed namespace
} // namespace ppc64
} // namespace simdutf

#endif // SIMDUTF_PPC64_SIMD_INPUT_H
/* end file src/simdutf/ppc64/simd.h */

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/ppc64/end.h
/* begin file src/simdutf/ppc64/end.h */
/* end file src/simdutf/ppc64/end.h */

#endif // SIMDUTF_IMPLEMENTATION_PPC64

#endif // SIMDUTF_PPC64_H
/* end file src/simdutf/ppc64.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback.h
/* begin file src/simdutf/fallback.h */
#ifndef SIMDUTF_FALLBACK_H
#define SIMDUTF_FALLBACK_H


// Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDUTF_IMPLEMENTATION_FALLBACK
#define SIMDUTF_IMPLEMENTATION_FALLBACK 1 // (!SIMDUTF_CAN_ALWAYS_RUN_ARM64 && !SIMDUTF_CAN_ALWAYS_RUN_HASWELL && !SIMDUTF_CAN_ALWAYS_RUN_WESTMERE && !SIMDUTF_CAN_ALWAYS_RUN_PPC64)
#endif
#define SIMDUTF_CAN_ALWAYS_RUN_FALLBACK SIMDUTF_IMPLEMENTATION_FALLBACK

#if SIMDUTF_IMPLEMENTATION_FALLBACK

namespace simdutf {
/**
* Fallback implementation (runs on any machine).
*/
namespace fallback {
} // namespace fallback
} // namespace simdutf

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/implementation.h
/* begin file src/simdutf/fallback/implementation.h */
#ifndef SIMDUTF_FALLBACK_IMPLEMENTATION_H
#define SIMDUTF_FALLBACK_IMPLEMENTATION_H


namespace simdutf {
namespace fallback {

namespace {
using namespace simdutf;
}

class implementation final : public simdutf::implementation {
public:
simdutf_really_inline implementation() : simdutf::implementation(
"fallback",
"Generic fallback implementation",
0
) {}
simdutf_warn_unused int detect_encodings(const char * input, size_t length) const noexcept final;
simdutf_warn_unused bool validate_utf8(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf8_with_errors(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_ascii(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_ascii_with_errors(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf16le(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf16be(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf16le_with_errors(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf16be_with_errors(const char16_t *buf, size_t len) const noexcept final;
simdutf_warn_unused bool validate_utf32(const char32_t *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf32_with_errors(const char32_t *buf, size_t len) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf16le(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf16be(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf16le_with_errors(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf16be_with_errors(const char * buf, size_t len, char16_t* utf16_output) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf16le(const char * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf16be(const char * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf8_to_utf32(const char * buf, size_t len, char32_t* utf32_output) const noexcept final;
simdutf_warn_unused result convert_utf8_to_utf32_with_errors(const char * buf, size_t len, char32_t* utf32_output) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf8_to_utf32(const char * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16le_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16be_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16le_to_utf8_with_errors(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16be_to_utf8_with_errors(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16le_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16be_to_utf8(const char16_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf8(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf8_with_errors(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf8(const char32_t * buf, size_t len, char* utf8_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf16le(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf32_to_utf16be(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf16le_with_errors(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused result convert_utf32_to_utf16be_with_errors(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf16le(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf32_to_utf16be(const char32_t * buf, size_t len, char16_t* utf16_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16le_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_utf16be_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16le_to_utf32_with_errors(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused result convert_utf16be_to_utf32_with_errors(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16le_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
simdutf_warn_unused size_t convert_valid_utf16be_to_utf32(const char16_t * buf, size_t len, char32_t* utf32_buffer) const noexcept final;
void change_endianness_utf16(const char16_t * buf, size_t length, char16_t * output) const noexcept final;
simdutf_warn_unused size_t count_utf16le(const char16_t * buf, size_t length) const noexcept;
simdutf_warn_unused size_t count_utf16be(const char16_t * buf, size_t length) const noexcept;
simdutf_warn_unused size_t count_utf8(const char * buf, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf16le(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf16be(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf16le(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf16be(const char16_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf16_length_from_utf8(const char * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf8_length_from_utf32(const char32_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf16_length_from_utf32(const char32_t * input, size_t length) const noexcept;
simdutf_warn_unused size_t utf32_length_from_utf8(const char * input, size_t length) const noexcept;
};

} // namespace fallback
} // namespace simdutf

#endif // SIMDUTF_FALLBACK_IMPLEMENTATION_H
/* end file src/simdutf/fallback/implementation.h */

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/begin.h
/* begin file src/simdutf/fallback/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "fallback"
// #define SIMDUTF_IMPLEMENTATION fallback
/* end file src/simdutf/fallback/begin.h */

// Declarations
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/bitmanipulation.h
/* begin file src/simdutf/fallback/bitmanipulation.h */
#ifndef SIMDUTF_FALLBACK_BITMANIPULATION_H
#define SIMDUTF_FALLBACK_BITMANIPULATION_H

#include <limits>

namespace simdutf {
namespace fallback {
namespace {

#if defined(_MSC_VER) && !defined(_M_ARM64) && !defined(_M_X64)
static inline unsigned char _BitScanForward64(unsigned long* ret, uint64_t x) {
unsigned long x0 = (unsigned long)x, top, bottom;
_BitScanForward(&top, (unsigned long)(x >> 32));
_BitScanForward(&bottom, x0);
*ret = x0 ? bottom : 32 + top;
return x != 0;
}
static unsigned char _BitScanReverse64(unsigned long* ret, uint64_t x) {
unsigned long x1 = (unsigned long)(x >> 32), top, bottom;
_BitScanReverse(&top, x1);
_BitScanReverse(&bottom, (unsigned long)x);
*ret = x1 ? top + 32 : bottom;
return x != 0;
}
#endif

} // unnamed namespace
} // namespace fallback
} // namespace simdutf

#endif // SIMDUTF_FALLBACK_BITMANIPULATION_H
/* end file src/simdutf/fallback/bitmanipulation.h */

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/end.h
/* begin file src/simdutf/fallback/end.h */
/* end file src/simdutf/fallback/end.h */

#endif // SIMDUTF_IMPLEMENTATION_FALLBACK
#endif // SIMDUTF_FALLBACK_H
/* end file src/simdutf/fallback.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake.h
/* begin file src/simdutf/icelake.h */
#ifndef SIMDUTF_ICELAKE_H
#define SIMDUTF_ICELAKE_H



#ifdef __has_include
// How do we detect that a compiler supports vbmi2?
// For sure if the following header is found, we are ok?
#if __has_include(<avx512vbmi2intrin.h>)
#define SIMDUTF_COMPILER_SUPPORTS_VBMI2 1
#endif
#endif

#ifdef _MSC_VER
#if _MSC_VER >= 1920
// Visual Studio 2019 and up support VBMI2 under x64 even if the header
// avx512vbmi2intrin.h is not found.
#define SIMDUTF_COMPILER_SUPPORTS_VBMI2 1
#endif
#endif

// We allow icelake on x64 as long as the compiler is known to support VBMI2.
#ifndef SIMDUTF_IMPLEMENTATION_ICELAKE
#define SIMDUTF_IMPLEMENTATION_ICELAKE ((SIMDUTF_IS_X86_64) && (SIMDUTF_COMPILER_SUPPORTS_VBMI2))
#endif

// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
// https://github.com/simdutf/simdutf/issues/1247
#define SIMDUTF_CAN_ALWAYS_RUN_ICELAKE ((SIMDUTF_IMPLEMENTATION_ICELAKE) && (SIMDUTF_IS_X86_64) && (__AVX2__) && (SIMDUTF_HAS_AVX512F && \
SIMDUTF_HAS_AVX512DQ && \
SIMDUTF_HAS_AVX512VL && \
SIMDUTF_HAS_AVX512VBMI2))

#if SIMDUTF_IMPLEMENTATION_ICELAKE
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
#define SIMDUTF_TARGET_ICELAKE
#define SIMDJSON_UNTARGET_ICELAKE
#else
#define SIMDUTF_TARGET_ICELAKE SIMDUTF_TARGET_REGION("avx512f,avx512dq,avx512cd,avx512bw,avx512vbmi,avx512vbmi2,avx512vl,avx2,bmi,bmi2,pclmul,lzcnt")
#define SIMDUTF_UNTARGET_ICELAKE SIMDUTF_UNTARGET_REGION
#endif
simd8<uint8_t>(this->chunks[1]) >= mask,
simd8<uint8_t>(this->chunks[2]) >= mask,
simd8<uint8_t>(this->chunks[3]) >= mask
).to_bitmask();
}
}; // struct simd8x64<T>

namespace simdutf {
namespace icelake {
} // namespace icelake
} // namespace simd
} // unnamed namespace
} // namespace ppc64
} // namespace simdutf

#endif // SIMDUTF_PPC64_SIMD_INPUT_H
/* end file src/simdutf/ppc64/simd.h */

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/ppc64/end.h
/* begin file src/simdutf/ppc64/end.h */
/* end file src/simdutf/ppc64/end.h */

//
// These two need to be included outside SIMDUTF_TARGET_REGION
//
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/intrinsics.h
/* begin file src/simdutf/icelake/intrinsics.h */
#ifndef SIMDUTF_ICELAKE_INTRINSICS_H
#define SIMDUTF_ICELAKE_INTRINSICS_H


#ifdef SIMDUTF_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
#include <intrin.h> // visual studio or clang
#include <immintrin.h>
#else
#endif // SIMDUTF_IMPLEMENTATION_PPC64

#if SIMDUTF_GCC11ORMORE
// We should not get warnings while including <x86intrin.h> yet we do
// under some versions of GCC.
// If the x86intrin.h header has uninitialized values that are problematic,
// it is a GCC issue, we want to ignore these warnigns.
SIMDUTF_DISABLE_GCC_WARNING(-Wuninitialized)
#endif
#endif // SIMDUTF_PPC64_H
/* end file src/simdutf/ppc64.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback.h
/* begin file src/simdutf/fallback.h */
#ifndef SIMDUTF_FALLBACK_H
#define SIMDUTF_FALLBACK_H

#include <x86intrin.h> // elsewhere

// Note that fallback.h is always imported last.

#if SIMDUTF_GCC11ORMORE
// cancels the suppression of the -Wuninitialized
SIMDUTF_POP_DISABLE_WARNINGS
// Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDUTF_IMPLEMENTATION_FALLBACK
#if SIMDUTF_CAN_ALWAYS_RUN_ARM64 || SIMDUTF_CAN_ALWAYS_RUN_ICELAKE || SIMDUTF_CAN_ALWAYS_RUN_HASWELL || SIMDUTF_CAN_ALWAYS_RUN_WESTMERE || SIMDUTF_CAN_ALWAYS_RUN_PPC64
#define SIMDUTF_IMPLEMENTATION_FALLBACK 0
#else
#define SIMDUTF_IMPLEMENTATION_FALLBACK 1
#endif
#endif

#ifndef _tzcnt_u64
#define _tzcnt_u64(x) __tzcnt_u64(x)
#endif // _tzcnt_u64
#endif // SIMDUTF_VISUAL_STUDIO

#ifdef SIMDUTF_CLANG_VISUAL_STUDIO
/**
* You are not supposed, normally, to include these
* headers directly. Instead you should either include intrin.h
* or x86intrin.h. However, when compiling with clang
* under Windows (i.e., when _MSC_VER is set), these headers
* only get included *if* the corresponding features are detected
* from macros:
* e.g., if __AVX2__ is set... in turn, we normally set these
* macros by compiling against the corresponding architecture
* (e.g., arch:AVX2, -mavx2, etc.) which compiles the whole
* software with these advanced instructions. In simdutf, we
* want to compile the whole program for a generic target,
* and only target our specific kernels. As a workaround,
* we directly include the needed headers. These headers would
* normally guard against such usage, but we carefully included
* <x86intrin.h> (or <intrin.h>) before, so the headers
* are fooled.
*/
#include <bmiintrin.h> // for _blsr_u64
#include <bmi2intrin.h> // for _pext_u64, _pdep_u64
#include <lzcntintrin.h> // for __lzcnt64
#include <immintrin.h> // for most things (AVX2, AVX512, _popcnt64)
#include <smmintrin.h>
#include <tmmintrin.h>
#include <avxintrin.h>
#include <avx2intrin.h>
#include <wmmintrin.h> // for _mm_clmulepi64_si128
// Important: we need the AVX-512 headers:
#include <avx512fintrin.h>
#include <avx512dqintrin.h>
#include <avx512cdintrin.h>
#include <avx512bwintrin.h>
#include <avx512vlintrin.h>
#include <avx512vlbwintrin.h>
#include <avx512vbmiintrin.h>
#include <avx512vbmi2intrin.h>
// unfortunately, we may not get _blsr_u64, but, thankfully, clang
// has it as a macro.
#ifndef _blsr_u64
// we roll our own
#define _blsr_u64(n) ((n - 1) & n)
#endif // _blsr_u64
#endif // SIMDUTF_CLANG_VISUAL_STUDIO



#if defined(__GNUC__) && !defined(__clang__)

#if __GNUC__ == 8
#define SIMDUTF_GCC8 1
#elif __GNUC__ == 9
#define SIMDUTF_GCC9 1
#endif // __GNUC__ == 8 || __GNUC__ == 9
#define SIMDUTF_CAN_ALWAYS_RUN_FALLBACK (SIMDUTF_IMPLEMENTATION_FALLBACK)

#endif // defined(__GNUC__) && !defined(__clang__)
#if SIMDUTF_IMPLEMENTATION_FALLBACK

#if SIMDUTF_GCC8
#pragma GCC push_options
#pragma GCC target("avx512f")
namespace simdutf {
/**
* GCC 8 fails to provide _mm512_set_epi8. We roll our own.
* Fallback implementation (runs on any machine).
*/
inline __m512i _mm512_set_epi8(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18, uint8_t a19, uint8_t a20, uint8_t a21, uint8_t a22, uint8_t a23, uint8_t a24, uint8_t a25, uint8_t a26, uint8_t a27, uint8_t a28, uint8_t a29, uint8_t a30, uint8_t a31, uint8_t a32, uint8_t a33, uint8_t a34, uint8_t a35, uint8_t a36, uint8_t a37, uint8_t a38, uint8_t a39, uint8_t a40, uint8_t a41, uint8_t a42, uint8_t a43, uint8_t a44, uint8_t a45, uint8_t a46, uint8_t a47, uint8_t a48, uint8_t a49, uint8_t a50, uint8_t a51, uint8_t a52, uint8_t a53, uint8_t a54, uint8_t a55, uint8_t a56, uint8_t a57, uint8_t a58, uint8_t a59, uint8_t a60, uint8_t a61, uint8_t a62, uint8_t a63) {
return _mm512_set_epi64(uint64_t(a7) + (uint64_t(a6) << 8) + (uint64_t(a5) << 16) + (uint64_t(a4) << 24) + (uint64_t(a3) << 32) + (uint64_t(a2) << 40) + (uint64_t(a1) << 48) + (uint64_t(a0) << 56),
uint64_t(a15) + (uint64_t(a14) << 8) + (uint64_t(a13) << 16) + (uint64_t(a12) << 24) + (uint64_t(a11) << 32) + (uint64_t(a10) << 40) + (uint64_t(a9) << 48) + (uint64_t(a8) << 56),
uint64_t(a23) + (uint64_t(a22) << 8) + (uint64_t(a21) << 16) + (uint64_t(a20) << 24) + (uint64_t(a19) << 32) + (uint64_t(a18) << 40) + (uint64_t(a17) << 48) + (uint64_t(a16) << 56),
uint64_t(a31) + (uint64_t(a30) << 8) + (uint64_t(a29) << 16) + (uint64_t(a28) << 24) + (uint64_t(a27) << 32) + (uint64_t(a26) << 40) + (uint64_t(a25) << 48) + (uint64_t(a24) << 56),
uint64_t(a39) + (uint64_t(a38) << 8) + (uint64_t(a37) << 16) + (uint64_t(a36) << 24) + (uint64_t(a35) << 32) + (uint64_t(a34) << 40) + (uint64_t(a33) << 48) + (uint64_t(a32) << 56),
uint64_t(a47) + (uint64_t(a46) << 8) + (uint64_t(a45) << 16) + (uint64_t(a44) << 24) + (uint64_t(a43) << 32) + (uint64_t(a42) << 40) + (uint64_t(a41) << 48) + (uint64_t(a40) << 56),
uint64_t(a55) + (uint64_t(a54) << 8) + (uint64_t(a53) << 16) + (uint64_t(a52) << 24) + (uint64_t(a51) << 32) + (uint64_t(a50) << 40) + (uint64_t(a49) << 48) + (uint64_t(a48) << 56),
uint64_t(a63) + (uint64_t(a62) << 8) + (uint64_t(a61) << 16) + (uint64_t(a60) << 24) + (uint64_t(a59) << 32) + (uint64_t(a58) << 40) + (uint64_t(a57) << 48) + (uint64_t(a56) << 56));
}
#pragma GCC pop_options
#endif // SIMDUTF_GCC8
namespace fallback {
} // namespace fallback
} // namespace simdutf

#endif // SIMDUTF_HASWELL_INTRINSICS_H
/* end file src/simdutf/icelake/intrinsics.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/implementation.h
/* begin file src/simdutf/icelake/implementation.h */
#ifndef SIMDUTF_ICELAKE_IMPLEMENTATION_H
#define SIMDUTF_ICELAKE_IMPLEMENTATION_H
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/implementation.h
/* begin file src/simdutf/fallback/implementation.h */
#ifndef SIMDUTF_FALLBACK_IMPLEMENTATION_H
#define SIMDUTF_FALLBACK_IMPLEMENTATION_H


namespace simdutf {
namespace icelake {
namespace fallback {

namespace {
using namespace simdutf;
@@ -3938,9 +3988,10 @@ using namespace simdutf;
class implementation final : public simdutf::implementation {
public:
simdutf_really_inline implementation() : simdutf::implementation(
"icelake",
"Intel AVX512 (AVX-512BW, AVX-512CD, AVX-512VL, AVX-512VBMI2 extensions)",
internal::instruction_set::AVX2 | internal::instruction_set::PCLMULQDQ | internal::instruction_set::BMI1 | internal::instruction_set::BMI2 | internal::instruction_set::AVX512BW | internal::instruction_set::AVX512CD | internal::instruction_set::AVX512VL | internal::instruction_set::AVX512VBMI2 ) {}
"fallback",
"Generic fallback implementation",
0
) {}
simdutf_warn_unused int detect_encodings(const char * input, size_t length) const noexcept final;
simdutf_warn_unused bool validate_utf8(const char *buf, size_t len) const noexcept final;
simdutf_warn_unused result validate_utf8_with_errors(const char *buf, size_t len) const noexcept final;
@@ -3996,66 +4047,61 @@ class implementation final : public simdutf::implementation {
simdutf_warn_unused size_t utf32_length_from_utf8(const char * input, size_t length) const noexcept;
};

} // namespace icelake
} // namespace fallback
} // namespace simdutf

#endif // SIMDUTF_ICELAKE_IMPLEMENTATION_H
/* end file src/simdutf/icelake/implementation.h */
#endif // SIMDUTF_FALLBACK_IMPLEMENTATION_H
/* end file src/simdutf/fallback/implementation.h */

//
// The rest need to be inside the region
//
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/begin.h
/* begin file src/simdutf/icelake/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "icelake"
// #define SIMDUTF_IMPLEMENTATION icelake
SIMDUTF_TARGET_ICELAKE
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/begin.h
/* begin file src/simdutf/fallback/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "fallback"
// #define SIMDUTF_IMPLEMENTATION fallback
/* end file src/simdutf/fallback/begin.h */

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_DISABLE_GCC_WARNING(-Wmaybe-uninitialized)
#endif // end of workaround
/* end file src/simdutf/icelake/begin.h */
// Declarations
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/bitmanipulation.h
/* begin file src/simdutf/icelake/bitmanipulation.h */
#ifndef SIMDUTF_ICELAKE_BITMANIPULATION_H
#define SIMDUTF_ICELAKE_BITMANIPULATION_H
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/bitmanipulation.h
/* begin file src/simdutf/fallback/bitmanipulation.h */
#ifndef SIMDUTF_FALLBACK_BITMANIPULATION_H
#define SIMDUTF_FALLBACK_BITMANIPULATION_H

#include <limits>

namespace simdutf {
namespace icelake {
namespace fallback {
namespace {

#ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
simdutf_really_inline unsigned __int64 count_ones(uint64_t input_num) {
// note: we do not support legacy 32-bit Windows
return __popcnt64(input_num);// Visual Studio wants two underscores
#if defined(_MSC_VER) && !defined(_M_ARM64) && !defined(_M_X64)
static inline unsigned char _BitScanForward64(unsigned long* ret, uint64_t x) {
unsigned long x0 = (unsigned long)x, top, bottom;
_BitScanForward(&top, (unsigned long)(x >> 32));
_BitScanForward(&bottom, x0);
*ret = x0 ? bottom : 32 + top;
return x != 0;
}
#else
simdutf_really_inline long long int count_ones(uint64_t input_num) {
return _popcnt64(input_num);
static unsigned char _BitScanReverse64(unsigned long* ret, uint64_t x) {
unsigned long x1 = (unsigned long)(x >> 32), top, bottom;
_BitScanReverse(&top, x1);
_BitScanReverse(&bottom, (unsigned long)x);
*ret = x1 ? top + 32 : bottom;
return x != 0;
}
#endif

} // unnamed namespace
} // namespace icelake
} // namespace fallback
} // namespace simdutf

#endif // SIMDUTF_ICELAKE_BITMANIPULATION_H
/* end file src/simdutf/icelake/bitmanipulation.h */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/end.h
/* begin file src/simdutf/icelake/end.h */
SIMDUTF_UNTARGET_REGION

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_POP_DISABLE_WARNINGS
#endif // end of workaround
/* end file src/simdutf/icelake/end.h */

#endif // SIMDUTF_FALLBACK_BITMANIPULATION_H
/* end file src/simdutf/fallback/bitmanipulation.h */

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/fallback/end.h
/* begin file src/simdutf/fallback/end.h */
/* end file src/simdutf/fallback/end.h */

#endif // SIMDUTF_IMPLEMENTATION_ICELAKE
#endif // SIMDUTF_ICELAKE_H
/* end file src/simdutf/icelake.h */
#endif // SIMDUTF_IMPLEMENTATION_FALLBACK
#endif // SIMDUTF_FALLBACK_H
/* end file src/simdutf/fallback.h */

namespace simdutf {
bool implementation::supported_by_runtime_system() const {
@@ -9890,7 +9936,7 @@ inline simdutf_warn_unused result validate_with_errors(const char *buf, size_t l
uint32_t code_point = 0;
while (pos < len) {
// check of the next 8 bytes are ascii.
uint64_t next_pos = pos + 16;
size_t next_pos = pos + 16;
if (next_pos <= len) { // if it is safe to read 8 more bytes, check that they are ascii
uint64_t v1;
std::memcpy(&v1, data + pos, sizeof(uint64_t));
@@ -15447,7 +15493,12 @@ simdutf_warn_unused size_t implementation::utf32_length_from_utf8(const char * i
/* begin file src/simdutf/icelake/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "icelake"
// #define SIMDUTF_IMPLEMENTATION icelake

#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
// nothing needed.
#else
SIMDUTF_TARGET_ICELAKE
#endif

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_DISABLE_GCC_WARNING(-Wmaybe-uninitialized)
@@ -15734,8 +15785,19 @@ simdutf_really_inline bool process_block_utf8_to_utf16(const char *&in, char16_t
}
//
if (tail == SIMDUTF_FULL) {
// In the two-byte/ASCII scenario, we are easily latency bound, so we want
// to increment the input buffer as quickly as possible.
// We process 32 bytes unless the byte at index 32 is a continuation byte,
// in which case we include it as well for a total of 33 bytes.
// Note that if x is an ASCII byte, then the following is false:
// int8_t(x) <= int8_t(0xc0) under two's complement.
in += 32;
if(int8_t(*in) <= int8_t(0xc0)) in++;
// The alternative is to do
// in += 64 - _lzcnt_u64(_pdep_u64(0xFFFFFFFF, continuation_or_ascii));
// but it requires loading the input, doing the mask computation, and converting
// back the mask to a general register. It just takes too long, leaving the
// processor likely to be idle.
} else {
in += 64 - _lzcnt_u64(_pdep_u64(0xFFFFFFFF, continuation_or_ascii));
}
@@ -18919,7 +18981,12 @@ simdutf_warn_unused size_t implementation::utf32_length_from_utf8(const char * i

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/icelake/end.h
/* begin file src/simdutf/icelake/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_ICELAKE
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif


#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_POP_DISABLE_WARNINGS
@@ -18935,8 +19002,12 @@ SIMDUTF_POP_DISABLE_WARNINGS
/* begin file src/simdutf/haswell/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "haswell"
// #define SIMDUTF_IMPLEMENTATION haswell
SIMDUTF_TARGET_HASWELL

#if SIMDUTF_CAN_ALWAYS_RUN_HASWELL
// nothing needed.
#else
SIMDUTF_TARGET_HASWELL
#endif

#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
SIMDUTF_DISABLE_GCC_WARNING(-Wmaybe-uninitialized)
@@ -22724,10 +22795,15 @@ simdutf_warn_unused size_t implementation::utf32_length_from_utf8(const char * i

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/haswell/end.h
/* begin file src/simdutf/haswell/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_HASWELL
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif


#if SIMDUTF_GCC11ORMORE // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
#pragma GCC diagnostic pop
SIMDUTF_POP_DISABLE_WARNINGS
#endif // end of workaround
/* end file src/simdutf/haswell/end.h */
/* end file src/haswell/implementation.cpp */
@@ -24223,7 +24299,12 @@ simdutf_warn_unused size_t implementation::utf32_length_from_utf8(const char * i
/* begin file src/simdutf/westmere/begin.h */
// redefining SIMDUTF_IMPLEMENTATION to "westmere"
// #define SIMDUTF_IMPLEMENTATION westmere

#if SIMDUTF_CAN_ALWAYS_RUN_WESTMERE
// nothing needed.
#else
SIMDUTF_TARGET_WESTMERE
#endif
/* end file src/simdutf/westmere/begin.h */
namespace simdutf {
namespace westmere {
@@ -28036,7 +28117,12 @@ simdutf_warn_unused size_t implementation::utf32_length_from_utf8(const char * i

// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/src, filename=simdutf/westmere/end.h
/* begin file src/simdutf/westmere/end.h */
#if SIMDUTF_CAN_ALWAYS_RUN_WESTMERE
// nothing needed.
#else
SIMDUTF_UNTARGET_REGION
#endif

/* end file src/simdutf/westmere/end.h */
/* end file src/westmere/implementation.cpp */
#endif
52 changes: 35 additions & 17 deletions deps/simdutf/simdutf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2022-12-15 12:13:17 -0500. Do not edit! */
/* auto-generated on 2023-01-02 15:43:33 -0500. Do not edit! */
// dofile: invoked with prepath=/Users/dlemire/CVS/github/simdutf/include, filename=simdutf.h
/* begin file include/simdutf.h */
#ifndef SIMDUTF_H
@@ -526,7 +526,7 @@ SIMDUTF_DISABLE_UNDESIRED_WARNINGS
#define SIMDUTF_SIMDUTF_VERSION_H
/** The version of simdutf being used (major.minor.revision) */
#define SIMDUTF_VERSION 2.0.9
#define SIMDUTF_VERSION "2.1.0"
namespace simdutf {
enum {
@@ -537,11 +537,11 @@ enum {
/**
* The minor version (major.MINOR.revision) of simdutf being used.
*/
SIMDUTF_VERSION_MINOR = 0,
SIMDUTF_VERSION_MINOR = 1,
/**
* The revision (major.minor.REVISION) of simdutf being used.
*/
SIMDUTF_VERSION_REVISION = 9
SIMDUTF_VERSION_REVISION = 0
};
} // namespace simdutf
@@ -795,7 +795,7 @@ namespace simdutf {
/**
* Autodetect the encoding of the input, a single encoding is recommended.
* E.g., the function might return simdutf::encoding_type::UTF8,
* E.g., the function might return simdutf::encoding_type::UTF8,
* simdutf::encoding_type::UTF16_LE, simdutf::encoding_type::UTF16_BE, or
* simdutf::encoding_type::UTF32_LE.
*
@@ -826,7 +826,9 @@ simdutf_really_inline simdutf_warn_unused int detect_encodings(const uint8_t * i
/**
* Validate the UTF-8 string.
* Validate the UTF-8 string. This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf8_with_errors.
*
* Overridden by each implementation.
*
@@ -859,7 +861,8 @@ simdutf_warn_unused result validate_utf8_with_errors(const char *buf, size_t len
simdutf_warn_unused bool validate_ascii(const char *buf, size_t len) noexcept;
/**
* Validate the ASCII string and stop on error.
* Validate the ASCII string and stop on error. It might be faster than
* validate_utf8 when an error is expected to occur early.
*
* Overridden by each implementation.
*
@@ -870,7 +873,9 @@ simdutf_warn_unused bool validate_ascii(const char *buf, size_t len) noexcept;
simdutf_warn_unused result validate_ascii_with_errors(const char *buf, size_t len) noexcept;
/**
* Validate the UTF-16LE string.
* Validate the UTF-16LE string. This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf16le_with_errors.
*
* Overridden by each implementation.
*
@@ -883,7 +888,9 @@ simdutf_warn_unused result validate_ascii_with_errors(const char *buf, size_t le
simdutf_warn_unused bool validate_utf16le(const char16_t *buf, size_t len) noexcept;
/**
* Validate the UTF-16BE string.
* Validate the UTF-16BE string. This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf16be_with_errors.
*
* Overridden by each implementation.
*
@@ -896,7 +903,8 @@ simdutf_warn_unused bool validate_utf16le(const char16_t *buf, size_t len) noexc
simdutf_warn_unused bool validate_utf16be(const char16_t *buf, size_t len) noexcept;
/**
* Validate the UTF-16LE string and stop on error.
* Validate the UTF-16LE string and stop on error. It might be faster than
* validate_utf16le when an error is expected to occur early.
*
* Overridden by each implementation.
*
@@ -909,7 +917,8 @@ simdutf_warn_unused bool validate_utf16be(const char16_t *buf, size_t len) noexc
simdutf_warn_unused result validate_utf16le_with_errors(const char16_t *buf, size_t len) noexcept;
/**
* Validate the UTF-16BE string and stop on error.
* Validate the UTF-16BE string and stop on error. It might be faster than
* validate_utf16be when an error is expected to occur early.
*
* Overridden by each implementation.
*
@@ -922,7 +931,9 @@ simdutf_warn_unused result validate_utf16le_with_errors(const char16_t *buf, siz
simdutf_warn_unused result validate_utf16be_with_errors(const char16_t *buf, size_t len) noexcept;
/**
* Validate the UTF-32LE string.
* Validate the UTF-32LE string. This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf32_with_errors.
*
* Overridden by each implementation.
*
@@ -935,7 +946,8 @@ simdutf_warn_unused result validate_utf16be_with_errors(const char16_t *buf, siz
simdutf_warn_unused bool validate_utf32(const char32_t *buf, size_t len) noexcept;
/**
* Validate the UTF-32LE string and stop on error.
* Validate the UTF-32LE string and stop on error. It might be faster than
* validate_utf32 when an error is expected to occur early.
*
* Overridden by each implementation.
*
@@ -1635,7 +1647,9 @@ class implementation {
simdutf_warn_unused virtual result validate_ascii_with_errors(const char *buf, size_t len) const noexcept = 0;
/**
* Validate the UTF-16LE string.
* Validate the UTF-16LE string.This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf16le_with_errors.
*
* Overridden by each implementation.
*
@@ -1648,7 +1662,9 @@ class implementation {
simdutf_warn_unused virtual bool validate_utf16le(const char16_t *buf, size_t len) const noexcept = 0;
/**
* Validate the UTF-16BE string.
* Validate the UTF-16BE string. This function may be best when you expect
* the input to be almost always valid. Otherwise, consider using
* validate_utf16be_with_errors.
*
* Overridden by each implementation.
*
@@ -1661,7 +1677,8 @@ class implementation {
simdutf_warn_unused virtual bool validate_utf16be(const char16_t *buf, size_t len) const noexcept = 0;
/**
* Validate the UTF-16LE string and stop on error.
* Validate the UTF-16LE string and stop on error. It might be faster than
* validate_utf16le when an error is expected to occur early.
*
* Overridden by each implementation.
*
@@ -1674,7 +1691,8 @@ class implementation {
simdutf_warn_unused virtual result validate_utf16le_with_errors(const char16_t *buf, size_t len) const noexcept = 0;
/**
* Validate the UTF-16BE string and stop on error.
* Validate the UTF-16BE string and stop on error. It might be faster than
* validate_utf16be when an error is expected to occur early.
*
* Overridden by each implementation.
*