acompiled

The catalog contains seeded project examples. Your workspace stores your own projects and conversations.

tsvet/utf8-check

Public
Star9

UTF-8 validation in x86-64: a scalar reference and an AVX2 version that checks 32 bytes per step. Every build fuzzes one against the other.

Code
Blame·4 commits across 38 linesoldernewer
Scalar validator with every range from table 3-7Jul 20 1# Verified builds for utf8-check.
2
3[project]
4isa = "x86-64"
5assembler = "nasm"
AVX2: three nibble tables and a saturating subtractAug 4 6target = "Windows x64 objects, AVX2"
8[[step]]
9name = "assemble the scalar reference"
10run = ["nasm", "-f", "win64", "-o", "build/utf8_scalar.obj", "src/utf8_scalar.asm"]
11
13name = "assemble AVX2"
14run = ["nasm", "-f", "win64", "-o", "build/utf8_avx2.obj", "src/utf8_avx2.asm"]
15
17name = "build the tests"
AVX2: three nibble tables and a saturating subtractAug 4 18run = ["gcc", "-O2", "-Wall", "-o", "build/test.exe", "test/test.c", "build/utf8_scalar.obj", "build/utf8_avx2.obj"]
20[[step]]
Fuzz the AVX2 version against the scalar oneAug 5 21name = "table 3-7, then 1,000,000 fuzzed inputs"
Fuzz the AVX2 version against the scalar oneAug 5 23run = ["./build/test.exe", "1000000"]
24expect = "0 mismatches"
27name = "build the benchmark"
AVX2: three nibble tables and a saturating subtractAug 4 28run = ["gcc", "-O2", "-Wall", "-o", "build/bench.exe", "bench/bench.c", "build/utf8_scalar.obj", "build/utf8_avx2.obj"]
30[[step]]
AVX2: three nibble tables and a saturating subtractAug 4 31name = "time both on 64 MiB"
33run = ["./build/bench.exe"]
34expect = "MiB of mixed text"
35
AVX2: three nibble tables and a saturating subtractAug 4 37path = "build/utf8_avx2.obj"
38paths = ["build/utf8_scalar.obj"]