44 lines
1.6 KiB
Markdown
44 lines
1.6 KiB
Markdown
# compare/ — backend output side-by-side with Calypsi 5.16
|
|
|
|
Each test case lives as three files:
|
|
|
|
- `<name>.c` — the C source.
|
|
- `<name>.ours.s` — our backend's assembly (`clang --target=w65816 -O2 -S`).
|
|
- `<name>.calypsi.lst` — Calypsi's listing file with source, hex bytes, and asm
|
|
in one document (`cc65816 --speed -O 2 --64bit-doubles`).
|
|
|
|
Calypsi's `--output` flag emits an ELF object, not text — its `--list-file` is the
|
|
human-readable artifact. (32-bit-doubles is Calypsi's default; we pass
|
|
`--64bit-doubles` so FP-heavy tests compare apples to apples against our IEEE-754
|
|
`double` ABI.)
|
|
|
|
## Regenerating
|
|
|
|
```
|
|
bash compare/regen.sh
|
|
```
|
|
|
|
Recompiles every `*.c` in this directory under both compilers and prints an
|
|
instruction-count summary:
|
|
|
|
```
|
|
test ours calypsi ratio
|
|
---- ---- ------- -----
|
|
evalAt 419 268 1.56x
|
|
mul16to32 12 11 1.09x
|
|
sumSquares 72 31 2.32x
|
|
```
|
|
|
|
(Numbers above are illustrative — re-run to see current state.)
|
|
|
|
## Adding a new comparison
|
|
|
|
Drop a `<name>.c` in this directory and run `regen.sh`. No other wiring needed.
|
|
|
|
## Counting methodology
|
|
|
|
The summary counts asm-line opcodes (lda/sta/jsl/...) on our side and listing
|
|
lines that begin with a hex byte (Calypsi's emit-byte column) on theirs.
|
|
Both metrics are static instruction counts, NOT bytes. They underestimate
|
|
calls-to-runtime (each libcall counts as one `jsl`, not the body it expands to).
|
|
For cycle counts, use `scripts/benchCyclesPrecise.sh`.
|