Skip to content

J.3: the x86-64 primary spec from ACL2, and encoder contracts (spec only) - #181

Open
atiernan wants to merge 9 commits into
claude/jit-isa-sourcesfrom
claude/x64-spec
Open

atiernan wants to merge 9 commits into
claude/jit-isa-sourcesfrom
claude/x64-spec

Conversation

@atiernan

@atiernan atiernan commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

JIT plan item J.3, first half: clazel-x64's primary spec, transcribed from ACL2 x86isa only, and the contracts for the encoder and decoder (rule 3). There is no implementation yet, and the crate stays at tier 0.

Stacked on #179, which holds the sources. Merge that PR first, or retarget this one afterwards.

What's here

  • src/spec.rs: about 2,800 lines, written from the vendored ACL2 x86isa model without reading the Intel SDM. The independent transcription from the SDM is a separate session's job.
    • Integer instructions: moves, the integer ALU ops, shifts, imul, and cmp/test, with their flag results.
    • Control flow: jcc, jmp, ret, cmovcc and setcc.
    • SSE2 scalar doubles: the arithmetic, ucomisd, the conversions, and movq/movsd.
    • Floating point: modelled exactly, with no uninterpreted functions, following Russinoff's RTL library. The rounding mode is fixed at round-to-nearest-even, so J.7's enter stub must set MXCSR and J.6's validator theorem must assume it.
    • Canonical encoding: one fixed byte form per instruction.
  • Contracts: requires/ensures for the encoder and decoder, on a body-less trait, with no escape hatch.

For the spec reviewer, first

  1. The canonical byte forms are our choice, not ACL2's. Every opcode used appears in ACL2's instruction listing.
  2. The rounding-mode assumption and where J.6 and J.7 must discharge it.
  3. Two ACL2 details for the hardware tests to settle:
    • ACL2's ret and jmp make extra canonical-address checks.
    • Its 32-bit cmovcc writes the destination (zero-extending it) even when the condition is false.

Sources added to #179 for this

The float arithmetic is defined in Russinoff's RTL library (books/rtl/rel11/lib/), and ucomisd in fp/logical.lisp. The first J.2 set left both out. Commit 2ee58b2 on #179 vendors them at the same pin, 33b05575, as the new suite acl2-rtl plus one more x86isa file.

Verification

  • Verus, on a fresh target dir in WSL: verification results:: 12 verified, 0 errors.
  • cargo xtask check: STATIC CHECKS PASSED. Build, tests and clippy are clean.
  • cargo xtask verify --changed was not run locally. CI's full verification is the check, and its proof jobs need approval.

🤖 Generated with Claude Code

atiernan and others added 2 commits November 16, 2026 20:26
… x86isa

State, semantics of every instruction of the subset, the IEEE binary64
operations, and the canonical encoding, as Verus spec functions. Tier stays 0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Body-less trait X64Codec: the encoder emits the canonical encoding, the
decoder accepts only canonical encodings, and they are inverse on the subset.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
atiernan and others added 2 commits November 17, 2026 20:20
CI's proof job requires a mutations.json for every crate Verus checks.
Three mutations of the encoding (REX.W and REX.R swapped, B8+r not
reduced mod 8, SIB index and base swapped), each killed by an existing
proven example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@atiernan
atiernan temporarily deployed to full-verification November 18, 2026 13:48 — with GitHub Actions Inactive
@atiernan
atiernan deployed to full-verification November 20, 2026 20:21 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
full-verification — a9887b05 Deployed Nov 20, 2026 by atiernan via Approve the proofs #616
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