I am still having great fun with this. Reached a point where I also need some user space programs for things like setting serial port properties, and locale translation tables, so I needed a full runtime library for CP/M, and decided that the easiest way to do that was through the platform support in z88dk. Then I saw that there were experimental support for another z80 llvm backend in z88dk and now I got it to support my work as well. I needed a non-trivial testcase and z88dk already had Dhrystone so these are the current numbers:
Dhrystone 2.1, @ 4 MHz Z80, 20000 runs:
•
llvmz80 -O2 — 8461 cycles/run, 0.2691 DMIPS (register, z80 16-bit ABI)
•
sdcc --sdcccall 1 -SO3 — 11044 cycles/run, 0.2061 DMIPS (register: args HL/DE, ret DE)
•
sdcc --sdcccall 0 -SO3 (z88dk default) — 12158 cycles/run, 0.1872 DMIPS (stack, IX frame, callee cleanup)
Key finding: switching sdcc to register-passing (sdcccall 1) buys −9.2% cycles / +10% DMIPS, but llvmz80 is still 30.5% faster than sdcc even with sdcccall 1 — so the calling convention explains only ~a third of the gap; the rest is LLVM's middle-end (inlining, loop deletion) + register allocation.
I do not know what the optimal runtime is, but I think we are catching up on raw assembly
