Skip to content

Pitfall: AMMX code with a separate LOAD or STORE - #84

Merged
WDrijver merged 3 commits into
mainfrom
core/ammx-operand-pitfall
Nov 24, 2026
Merged

WDrijver merged 3 commits into
mainfrom
core/ammx-operand-pitfall

Conversation

@WDrijver

Copy link
Copy Markdown
Contributor

New pitfall core/pitfalls/ammx-separate-load-and-store.md (draft, ai-assisted), from Gunnar's input of 2026-11-24.

  • AMMX operations take <vea> (register, memory or immediate) as their first operand, so a load of a value used once is waste; packuswb/pack3216 write to memory themselves, so a store after them is waste.
  • Other operations have no memory-destination form (PRM: future; vasm 2.0g rejects paddw d1,d2,(a0)), so their results still need store.
  • Exceptions: values reused by several instructions; PC-relative sources (existing pitfall); immediates.
  • vasm 2.0g: paddb.w #$0101,d1,d2 gives the PRM's repeated-word #imm.W; without the suffix it silently assembles a 64-bit immediate $0000000000000101. Gunnar's suggested #imm.w syntax is not supported (warning, quad).
  • Names: Gunnar's VSTORE… names mapped to the PRM/vasm names; PACK3116 was a typo for PACK3216 (confirmed).
  • Don't use loadi/storei (G). Their PRM pages are generated from sources/official/AC68080PRM.odt and are not changed here; removing or deprecating them is a maintainer decision on the original.
  • The cost of a memory source against a register source is not measured; Gunnar will measure it on Core 13000+.

Related links added in ammx-where-it-wins.md and vasm-68080-encoding-issues.md. The code examples assemble without warnings with vasm 2.0g.

Knowledge base files relied on

core/cpu-68080/prm/ammx/{ammx-format,load,store,storem,storem3,storec,storeilm,packuswb,pack3216,loadi,storei,padd}.md, core/pitfalls/ammx-pc-relative-source.md, core/cpu-68080/superscalar-issue.md.

🤖 Generated with Claude Code

Gunnar (2026-11-24): AI agents load every AMMX operand with LOAD and
store pack results with STORE. Operations take <vea> (register, memory
or immediate) as their first operand; store and pack instructions have
<vea> on the right. Don't use LOADI and STOREI.

Includes the vasm 2.0g syntax for the repeated-word immediate
(paddb.w #$0101) and the silent 64-bit immediate without the suffix,
the PC-relative exception, and the names vasm accepts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver
WDrijver requested a review from TuKo1982 as a code owner November 24, 2026 13:32
Decision WDrijver (option b): the original PRM stays as it is; the
converter marks loadi.md and storei.md deprecated, superseded by the
AMMX load/store pitfall, with a reason line from Gunnar's 2026-11-24
statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver

Copy link
Copy Markdown
Contributor Author

Added: the PRM converter now generates ammx/loadi.md and ammx/storei.md as deprecated (superseded by the new pitfall), with a reason line. Decision WDrijver: option b, the original PRM stays unchanged.

PR #64 broke the KB checks on main (MD056, too many cells).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver

Copy link
Copy Markdown
Contributor Author

Also fixes the Markdown lint failure on main since #64 (unescaped | in a table cell of os/libraries/workbench-wbconfig.md).

@WDrijver
WDrijver merged commit f364b69 into main Nov 24, 2026
2 checks passed
@WDrijver
WDrijver deleted the core/ammx-operand-pitfall branch November 24, 2026 13:59
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