Compare five real examples across four targets on three measured platforms, preserving raw samples, independent output verification and artifact provenance.
Complete the WebAssembly support needed by the examples, inspect ZX bundles, prune generated C dependencies while preserving C++ linkage, and validate native script execution. Optimize only the temporary bootstrap seed and retain fresh-build measurements and historical benchmark records under bench/results.
Local tests: all 522 cases passed across the full run and corrected header-test rerun; all 16 bootstrap modules match. Playground runtime, bundle runtime, private browser layouts and matrix controls, published artifacts and local site links passed.
A range over a computed bound was emitted as `while (i <= last)` with a
second exit, `if (i == last) break;`, before its step, so GCC refused to
vectorize it ("can't vectorize early exit"). When the counter and bound
are locals declared just before the loop, nothing takes their address and
every change of the counter is a step guarded by that last-value test, the
counter can never pass the bound, and C now writes
`if (i <= last) for (;;)`: one exit, which GCC can vectorize or turn into
memset, and TinyCC no longer tests the bound in every iteration.
AV1 1080p q40 decode (same hashes): gcc -O2 89 -> 86-88 ms, -O0 340 ->
335 ms, ziran run 609 -> 605 ms, -O3 unchanged at 77-79 ms.
TinyCC never inlines, so under `ziran run` every call of a tiny helper
paid a full call with all its locals on the stack. Generated C now writes
a call of a small straight-line procedure of the same module (no loops,
no module variables, scalars, pointers and small records only) as its
body in a block: arguments still run once, left to right, a return jumps
past the body, and the inlined call still costs the step its entry did.
Calls of foreign procedures stay out of inlined bodies, and private
procedures are declared ZIRAN_MAYBE_UNUSED for when every caller inlined
them.
A 1080p AV1 decode runs about 7% faster under `ziran run` and 4% faster
at -O0 with the same output; -O3 is unchanged. The bootstrap C is
regenerated. tests/call_site_inlining.sh covers argument order, name
clashes, early returns and the warning-free build.
A #target procedure gets a clone per x86-64 SIMD tier in C, and the
procedure itself picks one through CPUID and the OS's YMM state, read
once. ZIRAN_SIMD_TIER lowers the choice for tests. Checking keeps 256-bit
vectors from crossing the procedure's boundary by value, since AVX2
clones would pass them in YMM registers. Saved IR records the modifier
(format 61). TinyCC, NEON and other targets compile the procedure once.
#inline after a procedure's result makes generated C always inline it:
private procedures become static inline with always_inline on GCC and
Clang, and a public procedure keeps its cross-module header copy past the
usual size limits. A procedure that calls itself is rejected
(check.inline).
#cold marks a slow path: the C definition is noinline and cold, other
modules call its one definition instead of a header copy, and Go gets
//go:noinline. Neither modifier changes what a call does.
Saved IR records the modifier, so the ZIR format version is now 60.
tests/procedure_inlining.sh checks the attributes, which calls stay out
of line, C at -O0 and -O2, Go, native and portable results, saved IR, and
the rejected forms.
Generated C leaves out the bounds check of an index such as
row * stride + column when a guard bounds it: an earlier if that returns,
breaks or continues, an enclosing if or while condition, or the earlier
operands of && and ||, until a value they compare changes. Indexes and
guard comparisons become polynomials over parameters, invariant locals
and slice counts; each loop counter is replaced by its upper bound, and
the index is proven below the count or length when every step is exact.
Guards that miss the read, values moved after the guard and else-if
exits keep their checks.
On the AV1 benchmark (fixed binaries, interleaved, one core) 1080p q20
drops from 185.1 to 182.2 ms and 720p 4:4:4 is unchanged, but 1080p
10-bit q30 rises from 201.5 to 212 ms. All of that comes from the one
check left out of FindCdefDirection's sample read; the function alone runs
faster without it (102 against 105 ns per call), so the loss is a layout
effect in the decoder's context.
Share checked operands with the Rust backend, preserve caller storage for memory operands, and isolate CPU-feature helpers behind cached runtime detection. Fix quoted-brace discovery for one-line assembly procedures and target-width Rust word types.
Add source/saved IR conformance, explicit unsupported-variant fallbacks, cross-target evidence and a repeatable native-control benchmark.
A line such as 'for y: 0..2 { for x: 0..2 {' opened only the outer
block, and '} }' closed only one, so the file failed with
"unterminated declaration at end of file". A control header whose
body stays open now passes its remaining text on as the next logical
line without queueing a closer, and '} }' splits into two closers.
Unterminated literals inside the body still leave the line unsplit.