- src/interp/machine.zig: format-0 interpreter on the air64 target; checked/wrapping arithmetic, shifts, casts, aggregates, calls with a 1024-frame limit, traps as records with T0xxx codes - aji run: prints one JSON run record; exit code 4 on trap - conformance runner: `expect: run` with `result:`/`trap:`, every run executed twice and compared byte-for-byte; header keys must be single lowercase words - Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
28 lines
552 B
LLVM
28 lines
552 B
LLVM
; Iterative Fibonacci with loop-carried block parameters.
|
|
; expect: run
|
|
; result: 2880067194370816120
|
|
; phase: 0
|
|
; spec: docs/spec/07a-air-instructions.md
|
|
module test.fibonacci
|
|
air 0
|
|
lang 0.1
|
|
features []
|
|
|
|
fn @main() -> u64
|
|
effects []
|
|
entry:
|
|
%n = const.u64 90
|
|
%z = const.u64 0
|
|
%o = const.u64 1
|
|
br @loop(%z, %z, %o)
|
|
loop(%i: u64, %a: u64, %b: u64):
|
|
%d = ge.u64 %i, %n
|
|
cbr %d, @done(), @step()
|
|
step:
|
|
%c = add.checked.u64 %a, %b
|
|
%one = const.u64 1
|
|
%j = add.checked.u64 %i, %one
|
|
br @loop(%j, %b, %c)
|
|
done:
|
|
ret %a
|