Skip to content

Test SSE2 string scanning without SSSE3 - #6168

Open
joyhsia wants to merge 2 commits into
nlohmann:developfrom
joyhsia:fix/6157-test-the-sse2-string-scan-on-cpus-withou
Open

joyhsia wants to merge 2 commits into
nlohmann:developfrom
joyhsia:fix/6157-test-the-sse2-string-scan-on-cpus-withou

Conversation

@joyhsia

@joyhsia joyhsia commented Nov 26, 2026 •

Copy link
Copy Markdown

Exercise the SSE2 string scanners together with scalar UTF-8 validation on modern x86-64 CPUs. The default build takes the SSSE3 path, while JSON_NO_SIMD disables SSE2 as well, leaving the handover between the two implementations untested.

Add JSON_TEST_ASSUME_NO_SSSE3 to the CPU check used by both scanners and register two variants of the existing lexer and json_view builder suites. They compile with -mno-ssse3, verify the forced CPU result, and run the existing string cases through the fallback. Older compilers that already lack runtime SSSE3 dispatch keep their existing tests.

The forced CPU assertions fail against the original implementation and pass with the override. Normal builds retain the existing CPU detection. Both single headers were regenerated with make amalgamate.

Fixes #6157.

Validation: GCC 11 C++11 multi-header and single-header suites each passed all 165 CTest entries; the affected default and SSE2-only suites passed Clang 18 ASan/UBSan; make check-amalgamation passed. A separate gcov probe exercised both new override lines and valid/invalid UTF-8 at 40 byte offsets. The overall hosted coverage report is still pending.

Checklist

  • The changes are described in detail, both the what and why.
  • An existing issue is referenced.
  • Overall coverage report: pending hosted CI. Both new executable source lines have positive local gcov counts.
  • No public API or documented configuration changes are needed.
  • The source code is amalgamated by running make amalgamate.

Signed-off-by: joyhsia <2024141530037@stu.scu.edu.cn>
Signed-off-by: joyhsia <2024141530037@stu.scu.edu.cn>
@github-actions github-actions Bot added M tests CMake aspect: json_view json_document, json_view (zero-copy view) labels Nov 26, 2026
@joyhsia
joyhsia marked this pull request as ready for review November 26, 2026 13:03
@joyhsia
joyhsia requested a review from nlohmann as a code owner November 26, 2026 13:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aspect: json_view json_document, json_view (zero-copy view) CMake M tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test the SSE2 string scan on CPUs without SSSE3

1 participant