Files
R8Forge/asm/raw_add.r8asm
T
dsh 14af0ca6ff Standard library: flat metric, cache pre-warmed and committed
Every synth block in asm/ now says 'metric flat', so the seven block bodies are
optimised without the .tp walk and therefore do not depend on where the caller
puts its cells.  The resulting bodies are cached in .r8forge_cache/ and the
cache is committed, so a fresh clone assembles the library without waiting for
a single search.

asm/test.r8asm: 1674 -> 1666 characters.

The seven tables were re-derived after the switch and all match the hand written
implementations bit for bit (bit_raw_add still 0 9 10 19 12 21 22 31 repeated,
bit_raw_inc 0 5 6 11, and so on), so this is a pure length win.

One caveat: bit_raw_add's flat search still runs out of state budget (700M, the
table stops fitting in a laptop) and falls back to the layer answer, which is
what got cached for it.  The other six converge in milliseconds; the whole warm
up took 396 seconds, almost all of it that one block.
2026-11-06 18:55:18 +08:00

67 lines
1.2 KiB
Plaintext

%include "asm/lib.r8asm"
; bit 宏由 %synth 合成。
; stat 那张表是用 r8forge_derive 在旧实现上跑出来的:6 个参数、64 个输入组合,
; 每项是该组合下 6 个 bit 的终值。合成结果因此和旧实现逐位一致。
; Macro bit_raw_add
; %1: CellBit A
; %2: CellBit B
; %3: CellBit Ci
; %4: CellBit S
; %5: CellBit Co
; %6: CellBit buf
%synth bit_raw_add_synth
params 6
stat 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31 0 9 10 19 12 21 22 31
metric flat
mode tape
%endsynth
%macro bit_raw_add 6
.tp %4
set_0
.tp %5
set_0
.tp %6
set_0
bit_raw_add_synth %1 %2 %3 %4 %5 %6
%endmacro
; Macro raw_add
; %1: Cell A
; %2: Cell B
; %3: CellBit Ci
; %4: Cell S
; %5: CellBit Co
; %6: Cell tmp
%macro raw_add 6
.anchor before_raw_add
.tp %3
bit_copy %6 %5
.tp %6
ror
%rep _CELL_SIZE
bit_raw_add %1 %2 %3 %4 %5 %6
.tp %5
clb_bit_mov %3
.tp %1
ror
.tp %2
ror
.tp %4
ror
%endrep
.tp %3
clb_bit_mov %5
.tp %6
rol
clb_bit_mov %3
.tp before_raw_add
%endmacro