Skip to content

x86: opt-in -fzext-load, zero-extending loads with 64-bit results (#25, approved trusted-base change) - #37

Merged
AananthV merged 3 commits into
masterfrom
issue-25-zext-load
Oct 23, 2026
Merged

AananthV merged 3 commits into
masterfrom
issue-25-zext-load

Conversation

@AananthV

Copy link
Copy Markdown
Owner

Closes #25. Trusted-base change, approved by the owner on 2026-10-22 (recorded on #25).

Trusted part: exactly the approved text

  • x86/Asm.v: the four constructors Pmovzbq_rm, Pmovzwq_rm, Pmovzbq_rr and Pmovzwq_rr, the exec_load_zx helper, and their exec_instr cases.
  • x86/TargetPrinter.ml: the four printer cases, identical to the existing movzbl/movzwl ones.
  • extraction/extraction.v: flag wiring only.

Validation: asm_difftest group zxload compares the full 64-bit destination against the extracted semantics. 0 mismatches, and the upper 32 bits were always zeroed. The only undefined cases are misaligned 16-bit addresses, which the model treats as Stuck, as it does for the existing Pmovzw_rm. I re-ran the test with a fresh seed.

Verified part (behind -fzext-load, off by default)

  • New operators Ozextb64/Ozextw64, used by selection for longofintu of 8/16-bit unsigned loads and casts.
  • The Linear Loadop pass fuses the load with the extension. Binary load-op fusion remains gated on -fload-op.

Results

  • Flag off: generated code identical to master.
  • With -fzext-load: siphash24 −6% (my re-run: 0.163 → 0.153 s). aes is unchanged.

Protocol checklist (#1)

  • Trusted files touched: x86/Asm.v and x86/TargetPrinter.ml (approved text only), plus the flag line in extraction/extraction.v.
  • check_axioms.sh: adds only Compopts.optim_zextload.
  • make proof + make ccomp: all 6 targets. After rebasing onto master I re-checked x86_64 (clean build), arm and aarch64.
  • make -C test all test: 154 passed, both by default and with -fzext-load -fload-op -fshift-mask -ftrust-libm together.
  • Ledger: entry 6.

The branch was rebased onto master by me, with the owner's permission. The implementing agent's own rebase was blocked by the permission system. The two conflicts were adjacent flag declarations.

Also fixes the README "Changes" table, which blank lines had split into several pieces.

…sults

Trusted-base change approved in issue #25: the Asm instructions
Pmovzbq_rm, Pmovzwq_rm, Pmovzbq_rr and Pmovzwq_rr (movzbl/movzwl viewed
as producing a zero-extended 64-bit result), their semantics
(exec_load_zx) and their printing.

New operators Ozextb64/Ozextw64.  With -fzext-load (off by default),
selection turns longofintu of an 8/16-bit unsigned load or cast into
them, and the Linear Loadop pass fuses the load with the extension into
the memory forms.  The binary load-op fusion remains gated on -fload-op.

Without the flag the generated code is unchanged.  siphash24: -6%.
…tion 20)

Also fixes the README changes table, which blank lines had split, and
updates the verification summary.

Closes #25.
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.

x86: zero-extending byte loads and byte-field extraction (Tier 2 part of #6)

1 participant