Skip to content

fix(deps): update module github.com/go-asmgen/asmgen to v0.8.0 - #3

Merged
tannevaled merged 1 commit into
mainfrom
renovate/deps
Aug 31, 2026
Merged

tannevaled merged 1 commit into
mainfrom
renovate/deps

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
github.com/go-asmgen/asmgen v0.5.0 → v0.8.0 age confidence

Release Notes

go-asmgen/asmgen (github.com/go-asmgen/asmgen)

v0.8.0: — indexany4 + base64_decode, no new emit ops

Compare Source

Two new wasm-SIMD kernels, both assembled entirely from ops the tree already exposes. Additive-only bump; every existing consumer continues to work unchanged.

New kernels

`indexany4` — the twelfth kernel. A fixed 4-needle variant of `bytes.IndexAny`: given a buffer and four search bytes n1..n4, return the offset of the first byte in the buffer that equals any of the four, or -1 if none match. Callers duplicate entries in n1..n4 when they have fewer than four distinct needles; consumers with more either loop the kernel per set of four or fall back to scalar. Same shape as memchr but with four broadcast-key vectors and four compares OR-ed together. 10/10 wazero cases match `bytes.IndexAny` byte-for-byte, including whitespace-set search, 4-distinct-needle search, and zero-byte needles.

`base64_decode` — the thirteenth kernel and companion of base64_encode. 16 input chars → 12 output bytes per iteration, matching StdEncoding decode. A direct byte-level inverse of the encoder's Lemire dance:

  1. Convert each char to a 6-bit index via 5-range mask + subtract (`'0'..'9'`, `'A'..'Z'`, `'a'..'z'`, `'+'`, `'/'`).
  2. Precompute three shifted-left versions of the index vector (shl2, shl4, shl6) and two shifted-right versions (shr4, shr2).
  3. Assemble the output with four shuffle merges — two for the "left" halves picking shl2/shl4/shl6 per output position, two for the "right" halves picking shr4/shr2/idx.
  4. OR the two halves; `v128.store` writes 16 bytes per block with positions 12-15 as junk that the next block's store overwrites.

9/9 wazero cases round-trip through the reference encoder + kernel decode = original input, on sizes from 12 bytes to 1200 bytes (100 blocks).

No new emit-surface ops

Both kernels compose entirely from what v0.7.0 already exposed:

  • `indexany4`: `i8x16.splat`, `i8x16.eq`, `v128.or`, `i8x16.bitmask`, `i32.ctz`, `i32.eqz`, `i32.mul`, `i32.add`
  • `base64_decode`: `i8x16.shl`, `i8x16.shr_u`, `i8x16.shuffle`, `i8x16.ge_s`, `i8x16.le_s`, `i8x16.eq`, `i8x16.sub`, `v128.and`, `v128.or`, `v128.store`

This is the cleanest demonstration in the series so far that the emit surface scales additively — the last two additions grew the kernel catalogue from 11 to 13 without one line of new emit code.

Compatibility

Additive only. Every method on `Function`, every value type, every module/import shape from v0.7.0 continues to work unchanged.

To pin the new kernels use `@v0.8.0`:

```go
//go:generate sh -c "go run github.com/go-asmgen/asmgen/examples/wasm/indexany4@​v0.8.0 > indexany4.wat"
//go:generate sh -c "go run github.com/go-asmgen/asmgen/examples/wasm/base64_decode@​v0.8.0 > base64_decode.wat"
```

CI + docs

  • All 11 CI jobs green: 3 native `lib` (100% cov gate incl. `./wasm/...`), 6 asm-arches unchanged, `wasm-e2e` covers all 13 kernels.
  • 14/14 packages hold 100% statement coverage.
  • Docs updated at go-asmgen.github.io/docs/latest/wasm/ — kernel table + Kernels page + roadmap.

Shipped kernel catalogue (13 total)

Kernel Since Reference
`matchlen` v0.1.0 (fold v0.6.0) `bytes.Equal`
`hex` v0.1.0 (fold v0.6.0) `encoding/hex` (encode)
`popcount` v0.1.0 (fold v0.6.0) `math/bits`
`toupper` v0.1.0 (fold v0.6.0) `strings.ToUpper` (ASCII)
`memchr` v0.1.0 (fold v0.6.0) `bytes.IndexByte`
`isascii` v0.2.0 (fold v0.6.0) ASCII-only preflight
`utf8len` v0.2.0 (fold v0.6.0) `utf8.RuneCount` (valid UTF-8)
`hex_decode` v0.3.0 (fold v0.6.0) `encoding/hex.DecodeString`
`json_clean` v0.3.0 (fold v0.6.0) JSON-string bulk-copy preflight
`adler32` v0.7.0 `hash/adler32.Checksum`
`base64_encode` v0.7.0 `encoding/base64.StdEncoding`
`indexany4` v0.8.0 `bytes.IndexAny` (4-needle fixed set)
`base64_decode` v0.8.0 `encoding/base64.StdEncoding` (decode)

What's next

Genuinely open items (neither started this cycle):

  • utf-8 full validation (Lemire-Keiser) — carries state across blocks to handle multi-byte sequences that span block boundaries. Substantial project.
  • crc32 (table-based) — wasm-SIMD lacks PCLMULQDQ; a table-driven approach would need data-segment support in emit (currently not there).

License

BSD-3-Clause.

v0.7.0: — adler32 + base64_encode, 8 new emit ops

Compare Source

Two new wasm-SIMD kernels + eight new emit-surface ops. Additive-only bump; every existing consumer continues to work unchanged.

New kernels

`adler32` — the `hash/adler32` rolling checksum. Per 16-byte block, the weighted-byte-sum step uses `i16x8.extmul_low/high_i8x16_u` to widen and multiply against the coefficient vector [16,15,14,...,1] in one op each; max product 255×16=4080 fits in u16 so intermediate products stay exact. Kernel keeps `a` and `b` scalar, reads/writes them via caller pointers, no modulo in the loop (caller batches 5552-byte NMAX segments). 8/8 wazero cases match `hash/adler32.Checksum` byte-for-byte.

`base64_encode` — Lemire's SSE algorithm (arXiv:1704.00605) ported to wasm-SIMD. Per 12-byte block → 16 output chars. PMULHUW (no direct wasm-SIMD equivalent) is emulated via `i32x4.extmul_low/high_i16x8_u` + `i32x4.shr_u` by 16 + `i16x8.narrow_i32x4_u`. 6-bit indexes → ASCII via range-add offset pattern. 9/9 wazero cases match `encoding/base64.StdEncoding` byte-for-byte. Real bug caught during development by the verifier: `/` correction was -16 instead of -12; without the wazero cross-check, this would have landed idx=63 at '+' silently.

New emit-surface ops (8)

Op WAT Used by
`I16x8ExtmulLowI8x16U` `(i16x8.extmul_low_i8x16_u)` adler32
`I16x8ExtmulHighI8x16U` `(i16x8.extmul_high_i8x16_u)` adler32
`I32Store(offset)` `(i32.store offset=N)` adler32
`I16x8Mul` `(i16x8.mul)` base64_encode (PMULLW)
`I32x4ExtmulLowI16x8U` `(i32x4.extmul_low_i16x8_u)` base64_encode (PMULHUW emul)
`I32x4ExtmulHighI16x8U` `(i32x4.extmul_high_i16x8_u)` base64_encode (PMULHUW emul)
`I32x4ShrU` `(i32x4.shr_u)` base64_encode (PMULHUW emul)
`I16x8NarrowI32x4U` `(i16x8.narrow_i32x4_u)` base64_encode (PMULHUW emul)
`I8x16GtU` `(i8x16.gt_u)` base64_encode
`I8x16LtU` `(i8x16.lt_u)` future (unsigned range checks)
`I8x16Add` `(i8x16.add)` base64_encode

Compatibility

Additive only — every method on `Function`, every value type, every module/import shape from v0.6.0 continues to work unchanged. Consumers pinning `@v0.6.0` are unaffected.

To pin the new kernels use `@v0.7.0`:

```go
//go:generate sh -c "go run github.com/go-asmgen/asmgen/examples/wasm/adler32@​v0.7.0 > adler32.wat"
//go:generate sh -c "go run github.com/go-asmgen/asmgen/examples/wasm/base64_encode@​v0.7.0 > base64_encode.wat"
```

CI + docs

  • All 11 CI jobs green: 3 native `lib` (100% cov gate incl. `./wasm/...`), 6 asm-arches unchanged, `wasm-e2e` extended to cover all 11 kernels.
  • 12/12 packages hold 100% statement coverage.
  • Docs updated at go-asmgen.github.io/docs/latest/wasm/ — kernel table + Kernels page + roadmap.

Shipped kernel catalogue (11 total)

Kernel Since Reference
`matchlen` v0.1.0 (fold v0.6.0) `bytes.Equal`
`hex` v0.1.0 (fold v0.6.0) `encoding/hex` (encode)
`popcount` v0.1.0 (fold v0.6.0) `math/bits`
`toupper` v0.1.0 (fold v0.6.0) `strings.ToUpper` (ASCII)
`memchr` v0.1.0 (fold v0.6.0) `bytes.IndexByte`
`isascii` v0.2.0 (fold v0.6.0) ASCII-only preflight
`utf8len` v0.2.0 (fold v0.6.0) `utf8.RuneCount` (valid UTF-8)
`hex_decode` v0.3.0 (fold v0.6.0) `encoding/hex.DecodeString`
`json_clean` v0.3.0 (fold v0.6.0) JSON-string bulk-copy preflight
`adler32` v0.7.0 `hash/adler32.Checksum`
`base64_encode` v0.7.0 `encoding/base64.StdEncoding`

What's next

  • utf-8 full validation (Lemire-Keiser)
  • base64 decode (companion to base64_encode)
  • crc32 (table-based, since wasm-SIMD lacks PCLMULQDQ)
  • `bytes.IndexAny` (multi-needle memchr)

License

BSD-3-Clause.

v0.6.0: — wasm/ peer package + 9 wasm-SIMD kernels

Compare Source

Additive-only bump: adds the wasm-SIMD (v128) emitter as a seventh peer alongside the six existing Plan 9 asm packages. Everything from v0.5.0 continues to work unchanged.

What's new

wasm/ — WAT text emitter package (peer of amd64 / arm64 / riscv64 / loong64 / ppc64 / s390x). Programmatic emission of well-formed WebAssembly text modules for //go:wasmimport consumption.

examples/wasm/{matchlen, hex, hex_decode, popcount, toupper, memchr, isascii, utf8len, json_clean}/ — nine kernel generators, one per shipped kernel. Each has:

  • A golden-file test that pins the exact WAT output.
  • A main_test.go covering the generator's happy path and error branches.
  • A wazero cross-check in examples/wasm/verify/ against a Go stdlib reference.

CI: wasm-e2e job regenerates every kernel, drift-gates against the committed golden, wat2wasm-compiles, and runs the wazero verifier. lib job's 100% coverage gate now covers ./wasm/....

Shipped kernels (9 total)

Kernel Reference Wasm-SIMD ops it showcases
matchlen bytes.Equal v128.load, i8x16.eq, i8x16.all_true
hex encoding/hex i8x16.shr_u, i8x16.swizzle, i8x16.shuffle
hex_decode encoding/hex.DecodeString 3× i8x16.ge_s/le_s, i8x16.shl, v128.store64_lane
popcount math/bits i8x16.popcnt, extadd_pairwise chain
toupper strings.ToUpper (ASCII) i8x16.ge_s, i8x16.le_s, i8x16.sub
memchr bytes.IndexByte i8x16.splat, i8x16.bitmask, i32.ctz
isascii ASCII-only preflight i8x16.bitmask
utf8len utf8.RuneCount i8x16.bitmask + i32.popcnt
json_clean JSON-string bulk-copy preflight 2× i8x16.eq + AND/zero-eq

Origin — folded from go-asmgen/wasm

Previously shipped as a standalone github.com/go-asmgen/wasm module (tags v0.1.0, v0.2.0, v0.3.0, all still valid). Folded in as a peer here as of commit 95f9b4c.

Existing consumers pinning github.com/go-asmgen/wasm/... continue to work unchanged — the three shipped tags are immutable. New consumers should pin github.com/go-asmgen/asmgen/wasm/... or github.com/go-asmgen/asmgen/examples/wasm/<kernel> instead:

```go
//go:generate sh -c "go run github.com/go-asmgen/asmgen/examples/wasm/matchlen@​v0.6.0 > matchlen.wat"
```

Docs + CI

  • Full docs section: go-asmgen.github.io/docs/latest/wasm/ — overview, quickstart, kernels catalogue, design notes, Consumer CI pattern, roadmap.
  • All 11 CI jobs green on the fold's first push: 3 native lib (100% cov gate incl. ./wasm/...), 6 asm-arches unchanged, new wasm-e2e (drift + wat2wasm + wazero for all 9 kernels).

License

BSD-3-Clause.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate CLI.

@tannevaled
tannevaled merged commit 1c84600 into main Aug 31, 2026
9 checks passed
@tannevaled
tannevaled deleted the renovate/deps branch August 31, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant