Skip to content
@go-asmgen

go-asmgen

go-asmgen

go-asmgen

🌐 Website · 📚 Documentation

Ergonomic generation of Go-compatible Plan 9 assembly for every 64-bit Go target — amd64, arm64, riscv64, loong64, ppc64le (VSX) and s390x (vector facility, big-endian).

avo does this for amd64 by encoding instruction bytes itself — powerful, but exactly what makes extending it to new ISAs expensive. go-asmgen instead emits Plan 9 assembly text and lets the Go toolchain assembler (cmd/asm) encode it, so each architecture is just a thin move/register surface over a shared ABI0 layout model — not a byte-level encoder. avo stays the richer choice for amd64-specific work; go-asmgen's niche is one uniform builder across every target.

Repositories

Repo What it is
asmgen the library: shared ABI0 layout (abi) + per-arch builders (amd64/arm64/riscv64/loong64/ppc64le/s390x) + Plan 9 writer (emit)
docs MkDocs Material documentation, served at /docs/
go-asmgen.github.io the Hugo landing page
brand brand assets — logos & icons

Principles

  • Delegate encoding to cmd/asm. Emitting text, not bytes, is what keeps adding an architecture cheap and keeps every instruction encoded by the same toolchain that compiles the rest of the program. The exception is an instruction cmd/asm cannot assemble yet. Those are the ppc64le VSX float64 arithmetic (XVADDDP…) and the loong64 vector fused multiply-add (VFMADDD…). go-asmgen emits each one as a WORD whose comment gives the spelling proposed for cmd/asm, and keeps its encoding, references and proposed spelling in a registry (internal/gap). From that registry come the Go patches in goasm-patches/, and a weekly check that notices when Go catches up. Since v0.15.0 the arm64 vector float64 arithmetic (VFADD2D…) and the loong64 broadcast load are encoded by cmd/asm.
  • Target ABI0, not ABIInternal. ABI0 (stack-based, FP-relative) is the stable contract hand-written .s targets; ABIInternal can change between Go releases.
  • Verified by go vet asmdecl. Every emitted name+offset(FP) is cross-checked against the Go declaration in CI, and exercised by a runtime test — natively on amd64 and arm64, under qemu-user for riscv64, loong64, ppc64le and s390x (the s390x job exercising the big-endian path).
  • 100% test coverage of the library, enforced as a CI gate on every repository.
  • Security policy. The emitted assembly runs outside Go's memory safety, so a wrong encoding is a vulnerability: SECURITY.md says what counts and how to report it privately. CI runs govulncheck.

Status

Released — go get github.com/go-asmgen/asmgen@latest (latest v0.16.0, which requires Go 1.27.1).

All six 64-bit targets, ABI0, at functional parity for scalars (signed/unsigned ints 1/2/4/8 bytes, pointers, 32/64-bit floats), stack frames + arbitrary TEXT flags (NewFuncFlags), and SIMD via the Raw escape hatch — SSE2 + AVX2 (amd64), NEON (arm64), RVV (riscv64), LSX + LASX (loong64), VSX (ppc64le), vector facility (s390x, big-endian), up to 256-bit. Struct/slice/string aggregates and fixed-size arrays by value are proven generically in the shared layout model, with dedicated runtime-tested examples on four targets (amd64, arm64, riscv64, loong64) today. Each architecture differs only in its move table. A typed vector helper, first-class vector types, and aggregate/array examples for ppc64le and s390x are the main remaining items.

Links

Popular repositories Loading

  1. asmgen asmgen Public

    Ergonomic generation of Go-compatible Plan 9 assembly for every 64-bit Go target — amd64, arm64, riscv64, and loong64

    Go 2

  2. go-asmgen.github.io go-asmgen.github.io Public

    HTML

  3. docs docs Public

  4. .github .github Public

    go-asmgen organization profile

    JavaScript

  5. brand brand Public

    Brand assets — logos & icons

Repositories

Showing 5 of 5 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…