Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions core/best-practices/align-copy-destination.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sources:
- "TuKo1982, 68080 compilation and optimisation guide (2026-10-30), sections 0 (rules 12-13), 5.1 and 12"
- "Gunnar (core developer), answers to questions on the guidelines, 2026-11-03"
- "Gunnar (core developer), Simply 68080 coding guidelines, version of 2026-11-23"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Goal
Expand Down Expand Up @@ -56,10 +57,10 @@ Copy of a 156 x 2464-byte shape (M, Core 12841):
- Copies under 1 KB: don't add code to align the pointers; use a simple copy
loop (G, 2026-11-23).
- Gunnar states that the CPU reads and writes misaligned without penalty and
combines writes into 16-byte chunks (G, 2026-11-23; on 2026-11-03 he
expected misaligned writes to work well "in many cases"). That conflicts
with the 1.7–1.8x measured above for a misaligned destination on
2464-byte rows (M, Core 12841). Until this is re-measured, align the
destination of large copies and fills.
combines writes into 16-byte chunks (G, 2026-11-23). This applies to
**Core 13000+** (G, 2026-11-24). On Core 12841 a misaligned destination
measured 1.7–1.8x slower on 2464-byte rows (M), so on cores before 13000,
align the destination of large copies and fills. To be re-measured on
Core 13000+.
- Tiny shapes: for rows of 64 bytes or less, plain 68k code wins (see
[ammx-where-it-wins.md](ammx-where-it-wins.md)).
8 changes: 5 additions & 3 deletions core/best-practices/memory-access-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sources:
- "Gunnar (core developer), Simply 68080 coding guidelines, draft (2026-11-03)"
- "Gunnar (core developer), answers to questions on the guidelines, 2026-11-03"
- "Gunnar (core developer), Simply 68080 coding guidelines, version of 2026-11-23"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Goal
Expand All @@ -37,9 +38,10 @@ overlap.
- Put data that is used together in the same 64-byte line.
- Don't use a table for anything you can compute in 16 cycles or less (G,
2026-11-03). MUL and DIV beat a table; a SIN table makes sense. Keep the
tables you do use small and hot. Gunnar puts a table miss at around 16
cycles of stall, so 10 cycles of arithmetic can beat a table access
(G, 2026-11-23); the random miss measured below costs about 27 (M).
tables you do use small and hot. A typical table miss costs about 16
cycles of stall; use 16 as the reference (G, 2026-11-24). So 10 cycles of
arithmetic can beat a table access (G, 2026-11-23). The 27 measured below
is a bad case: dependent random reads over 4 MB (M).
- Avoid rows exactly 64 KB apart: they alias in the cache.
- Use `touch d8(An,Dn)` 12–15 cycles ahead only for random accesses, never
on a sequential stream.
Expand Down
12 changes: 7 additions & 5 deletions core/cpu-68080/caches-and-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sources:
- "Gunnar (core developer), memory controller width, 2026-11-04"
- "WDrijver (maintainer), same core on every V4 model, 2026-11-04"
- "Gunnar (core developer), Simply 68080 coding guidelines, version of 2026-11-23"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Summary
Expand Down Expand Up @@ -86,8 +87,9 @@ The memory controller is part of the core, so it is the same on every V4
model that runs the same core (see
[hardware/index.md](../../hardware/index.md)).

The 27 cycles above are one case: dependent random reads over 4 MB. When
you measure a miss, state these conditions.
The 27 cycles above are one case: dependent random reads over 4 MB. The
typical miss, to use as the reference, is about 16 cycles of stall (G,
2026-11-24). When you measure a miss, state these conditions.

Memory-bound measurements from a core before 12600 (64-bit controller) are
not comparable with those from Core 12600 and later. All measurements in
Expand All @@ -110,9 +112,9 @@ Copy of a 156 x 2464-byte shape (M):
0–13 %.
- Gunnar (G, 2026-11-23): misaligned reads and writes have no penalty, a
read may span two cache lines, writes are combined into 16-byte chunks,
and copies under 1 KB need no alignment code. The "no penalty" for writes
conflicts with the 1.7–1.8x measured above (M, Core 12841); to be
re-measured.
and copies under 1 KB need no alignment code. This applies to Core 13000+
(G, 2026-11-24); on Core 12841 the 1.7–1.8x above stands (M). To be
re-measured on Core 13000+.
- Copies are memory-bound at about 3 bytes per cycle: optimising a blit copy
gained only 3–10 %.
- A `.b`/`.w` write into a register also reads its old value: an extra
Expand Down
7 changes: 5 additions & 2 deletions core/cpu-68080/execution-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sources:
- "Gunnar (core developer), Simply 68080 coding guidelines, draft (2026-11-03)"
- "Gunnar (core developer), answers to questions on the guidelines, 2026-11-03"
- "Gunnar (core developer), Simply 68080 coding guidelines, version of 2026-11-23"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Summary
Expand Down Expand Up @@ -59,8 +60,10 @@ the ALUs that own the data registers. Most cores run 2 pipes; 3 are planned.
- `bsr.s`, `bsr.w` and `bsr.l` typically take 1 cycle (G, 2026-11-23).
- `dbra.w` (16-bit counter) and `dbra.l` (32-bit counter) take a single
cycle and can be the last instruction of a group (G, 2026-11-23). The
counter can be any data register D0–D31 (G, 2026-11-23; see
[bank-prefix.md](bank-prefix.md) for D8–D31 = E0–E23). See
counter can be any data register D0–D31 (G, 2026-11-23): all ALU
(integer) instructions can use the 32 data registers D0–D31, in byte,
word and long size (G, 2026-11-24). See [bank-prefix.md](bank-prefix.md)
for D8–D31 = E0–E23 and how they are encoded. See
[close-loops-with-dbra.md](../best-practices/close-loops-with-dbra.md).
- `jmp (An)` is computed by the EA unit and takes much longer than the
branches in the first row.
Expand Down
8 changes: 6 additions & 2 deletions core/cpu-68080/fpu-performance-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ related:
sources:
- "TuKo1982, 68080 compilation and optimisation guide (2026-10-30), section 4.1"
- "Gunnar (core developer), Simply 68080 coding guidelines, draft (2026-11-03)"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Summary
Expand Down Expand Up @@ -53,8 +54,11 @@ predicted all 25 measured patterns exactly.
- Gunnar's rule (G): **a pipelined unit showing more than 1 cycle per
instruction means the schedule is wrong.**
- Gunnar's rule of thumb (G): expect about 6 cycles latency for fadd and
fmul, unroll FPU code to cover it, and use the 32 registers available for
FPU work (FP0–FP7 and E0–E23). The measured fmul latency is 5.
fmul, and unroll FPU code to cover it. The measured fmul latency is 5.
- Current cores have the 8 FPU registers of the 68K (FP0–FP7), and FPU code
is normal 68K code. Later cores will let the FPU use all 32 registers
(G, 2026-11-24). This corrects an earlier note here that FPU work could
use FP0–FP7 and E0–E23.

## Differences from AmigaOS / AROS / 68060

Expand Down
7 changes: 5 additions & 2 deletions core/pitfalls/ammx-separate-load-and-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sources:
- "Gunnar (core developer), AMMX operand forms, 2026-11-24"
- "Apollo 68080 PRM (sources/official/AC68080PRM.odt), AMMX format page"
- "vasm 2.0g (ApolloCrossDev GCC-6.50-Dev), test assembly of the forms below, 2026-11-24"
- "Gunnar (core developer), answers on the guidelines, 2026-11-24"
---

## Symptom
Expand Down Expand Up @@ -96,8 +97,10 @@ An immediate is an operand too:
`paddb #$0101,d1,d2` assembles silently to a 64-bit immediate
`$0000000000000101` (12-byte instruction), so only the lowest lanes get
the value. `paddb #$0101.w,d1,d2` does the same, with a "trailing garbage"
warning. Gunnar suggests `#imm.w` as the syntax (G); vasm does not
support it.
warning. Gunnar prefers `#$0101.w`, the 68K convention of qualifying
the value, as in `move.l $04.w,a6` (G, 2026-11-24); vasm 2.0g does not
support it for AMMX. The team is discussing the syntax, so this may
change: check the vasm version you use.
- **Names:** Gunnar calls the store instructions VSTORE, VSTOREM,
VSTOREC, VSTOREM2 and VSTOREM3. vasm accepts only the PRM names `store`,
`storem`, `storec`, `storeilm` (the PRM: "also called storem2") and
Expand Down