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

deps: update simdutf to 5.6.3 #55973

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
89 changes: 51 additions & 38 deletions deps/simdutf/simdutf.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2024-11-14 14:52:31 -0500. Do not edit! */
/* auto-generated on 2024-11-21 10:33:28 -0500. Do not edit! */
/* begin file src/simdutf.cpp */
#include "simdutf.h"
// We include base64_tables once.
Expand Down Expand Up @@ -23495,7 +23495,7 @@ size_t encode_base64(char *dst, const char *src, size_t srclen,
}

template <bool base64_url>
static inline uint64_t to_base64_mask(block64 *b, bool *error) {
static inline uint64_t to_base64_mask(block64 *b, uint64_t *error) {
__m512i input = b->chunks[0];
const __m512i ascii_space_tbl = _mm512_set_epi8(
0, 0, 13, 12, 0, 10, 9, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 13, 12, 0, 10,
Expand Down Expand Up @@ -23538,7 +23538,7 @@ static inline uint64_t to_base64_mask(block64 *b, bool *error) {
if (mask) {
const __mmask64 spaces = _mm512_cmpeq_epi8_mask(
_mm512_shuffle_epi8(ascii_space_tbl, input), input);
*error |= (mask != spaces);
*error = (mask ^ spaces);
}
b->chunks[0] = translated;

Expand Down Expand Up @@ -23646,16 +23646,13 @@ compress_decode_base64(char *dst, const chartype *src, size_t srclen,
block64 b;
load_block(&b, src);
src += 64;
bool error = false;
uint64_t error = 0;
uint64_t badcharmask = to_base64_mask<base64_url>(&b, &error);
if (error) {
src -= 64;
while (src < srcend && scalar::base64::is_eight_byte(*src) &&
to_base64[uint8_t(*src)] <= 64) {
src++;
}
return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
size_t(dst - dstinit)};
size_t error_offset = _tzcnt_u64(error);
return {error_code::INVALID_BASE64_CHARACTER,
size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
}
if (badcharmask != 0) {
// optimization opportunity: check for simple masks like those made of
Expand Down Expand Up @@ -28240,7 +28237,7 @@ struct block64 {
};

template <bool base64_url>
static inline uint32_t to_base64_mask(__m256i *src, bool *error) {
static inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
const __m256i ascii_space_tbl =
_mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
Expand Down Expand Up @@ -28324,17 +28321,19 @@ static inline uint32_t to_base64_mask(__m256i *src, bool *error) {
if (mask) {
__m256i ascii_space =
_mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
*error |= (mask != _mm256_movemask_epi8(ascii_space));
*error = (mask ^ _mm256_movemask_epi8(ascii_space));
}
*src = out;
return (uint32_t)mask;
}

template <bool base64_url>
static inline uint64_t to_base64_mask(block64 *b, bool *error) {
*error = 0;
uint64_t m0 = to_base64_mask<base64_url>(&b->chunks[0], error);
uint64_t m1 = to_base64_mask<base64_url>(&b->chunks[1], error);
static inline uint64_t to_base64_mask(block64 *b, uint64_t *error) {
uint32_t err0 = 0;
uint32_t err1 = 0;
uint64_t m0 = to_base64_mask<base64_url>(&b->chunks[0], &err0);
uint64_t m1 = to_base64_mask<base64_url>(&b->chunks[1], &err1);
*error = err0 | ((uint64_t)err1 << 32);
return m0 | (m1 << 32);
}

Expand Down Expand Up @@ -28466,16 +28465,13 @@ compress_decode_base64(char *dst, const chartype *src, size_t srclen,
block64 b;
load_block(&b, src);
src += 64;
bool error = false;
uint64_t error = 0;
uint64_t badcharmask = to_base64_mask<base64_url>(&b, &error);
if (error) {
src -= 64;
while (src < srcend && scalar::base64::is_eight_byte(*src) &&
to_base64[uint8_t(*src)] <= 64) {
src++;
}
return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
size_t(dst - dstinit)};
size_t error_offset = _tzcnt_u64(error);
return {error_code::INVALID_BASE64_CHARACTER,
size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
}
if (badcharmask != 0) {
// optimization opportunity: check for simple masks like those made of
Expand Down Expand Up @@ -37992,7 +37988,7 @@ struct block64 {
};

template <bool base64_url>
static inline uint16_t to_base64_mask(__m128i *src, bool *error) {
static inline uint16_t to_base64_mask(__m128i *src, uint32_t *error) {
const __m128i ascii_space_tbl =
_mm_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa, 0x0,
0xc, 0xd, 0x0, 0x0);
Expand Down Expand Up @@ -38059,22 +38055,42 @@ static inline uint16_t to_base64_mask(__m128i *src, bool *error) {
if (mask) {
__m128i ascii_space =
_mm_cmpeq_epi8(_mm_shuffle_epi8(ascii_space_tbl, *src), *src);
*error |= (mask != _mm_movemask_epi8(ascii_space));
*error = (mask ^ _mm_movemask_epi8(ascii_space));
}
*src = out;
return (uint16_t)mask;
}

template <bool base64_url>
static inline uint64_t to_base64_mask(block64 *b, bool *error) {
*error = 0;
uint64_t m0 = to_base64_mask<base64_url>(&b->chunks[0], error);
uint64_t m1 = to_base64_mask<base64_url>(&b->chunks[1], error);
uint64_t m2 = to_base64_mask<base64_url>(&b->chunks[2], error);
uint64_t m3 = to_base64_mask<base64_url>(&b->chunks[3], error);
static inline uint64_t to_base64_mask(block64 *b, uint64_t *error) {
uint32_t err0 = 0;
uint32_t err1 = 0;
uint32_t err2 = 0;
uint32_t err3 = 0;
uint64_t m0 = to_base64_mask<base64_url>(&b->chunks[0], &err0);
uint64_t m1 = to_base64_mask<base64_url>(&b->chunks[1], &err1);
uint64_t m2 = to_base64_mask<base64_url>(&b->chunks[2], &err2);
uint64_t m3 = to_base64_mask<base64_url>(&b->chunks[3], &err3);
*error = (err0) | ((uint64_t)err1 << 16) | ((uint64_t)err2 << 32) |
((uint64_t)err3 << 48);
return m0 | (m1 << 16) | (m2 << 32) | (m3 << 48);
}

#if defined(_MSC_VER) && !defined(__clang__)
static inline size_t simdutf_tzcnt_u64(uint64_t num) {
unsigned long ret;
if (num == 0) {
return 64;
}
_BitScanForward64(&ret, num);
return ret;
}
#else // GCC or Clang
static inline size_t simdutf_tzcnt_u64(uint64_t num) {
return num ? __builtin_ctzll(num) : 64;
}
#endif

static inline void copy_block(block64 *b, char *output) {
_mm_storeu_si128(reinterpret_cast<__m128i *>(output), b->chunks[0]);
_mm_storeu_si128(reinterpret_cast<__m128i *>(output + 16), b->chunks[1]);
Expand Down Expand Up @@ -38222,16 +38238,13 @@ compress_decode_base64(char *dst, const chartype *src, size_t srclen,
block64 b;
load_block(&b, src);
src += 64;
bool error = false;
uint64_t error = 0;
uint64_t badcharmask = to_base64_mask<base64_url>(&b, &error);
if (error) {
src -= 64;
while (src < srcend && scalar::base64::is_eight_byte(*src) &&
to_base64[uint8_t(*src)] <= 64) {
src++;
}
return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
size_t(dst - dstinit)};
size_t error_offset = simdutf_tzcnt_u64(error);
return {error_code::INVALID_BASE64_CHARACTER,
size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
}
if (badcharmask != 0) {
// optimization opportunity: check for simple masks like those made of
Expand Down
16 changes: 8 additions & 8 deletions deps/simdutf/simdutf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2024-11-14 14:52:31 -0500. Do not edit! */
/* auto-generated on 2024-11-21 10:33:28 -0500. Do not edit! */
/* begin file include/simdutf.h */
#ifndef SIMDUTF_H
#define SIMDUTF_H
Expand Down Expand Up @@ -155,11 +155,11 @@
// RISC-V 64-bit
#define SIMDUTF_IS_RISCV64 1

#if __clang_major__ >= 19
// Does the compiler support target regions for RISC-V
#define SIMDUTF_HAS_RVV_TARGET_REGION 1
#endif

// #if __riscv_v_intrinsic >= 1000000
// #define SIMDUTF_HAS_RVV_INTRINSICS 1
// #define SIMDUTF_HAS_RVV_TARGET_REGION 1
// #elif ...
// Check for special compiler versions that implement pre v1.0 intrinsics
#if __riscv_v_intrinsic >= 11000
#define SIMDUTF_HAS_RVV_INTRINSICS 1
#endif
Expand Down Expand Up @@ -670,7 +670,7 @@ SIMDUTF_DISABLE_UNDESIRED_WARNINGS
#define SIMDUTF_SIMDUTF_VERSION_H

/** The version of simdutf being used (major.minor.revision) */
#define SIMDUTF_VERSION "5.6.2"
#define SIMDUTF_VERSION "5.6.3"

namespace simdutf {
enum {
Expand All @@ -685,7 +685,7 @@ enum {
/**
* The revision (major.minor.REVISION) of simdutf being used.
*/
SIMDUTF_VERSION_REVISION = 2
SIMDUTF_VERSION_REVISION = 3
};
} // namespace simdutf

Expand Down
Loading