Files
aji/tests/conformance/phase0/accept/loop_block_params.air
T
dev 17a55a7fef Initial import: Aji 0.1 draft spec and Zig scaffolding
Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.
2026-10-04 11:59:13 +03:00

23 lines
423 B
LLVM

; Counting loop passing state through block parameters instead of phi nodes.
; expect: accept
; phase: 0
; spec: docs/spec/07-air.md
fn @count(%n: u64) -> u64
effects []
entry:
%zero = const.u64 0
br @loop(%zero)
loop(%i: u64):
%done = ge.u64 %i, %n
cbr %done, @exit(%i), @body(%i)
body(%j: u64):
%one = const.u64 1
%next = add.checked.u64 %j, %one
br @loop(%next)
exit(%r: u64):
ret %r