2.3 KiB
C0510 — §396(a) correction: a zero-byte barrier CAN fence an slti;beqz cross-jump when placed between beqz and j
tags: cross-jump,barrier,reorg,cond-expr,correction · date: 2026-09-30 · phase/task: 38/T7 · origin: P36 S104 ov_SC03_110/func_801800F0 mechanism.md; corrects C0442
§396(a) correction — a zero-byte barrier CAN fence an slti; beqz cross-jump, if it sits between the beqz and the j (P36 S104, recorded P38 T7)
C0442 §396(a) says __asm__("") "does not stop" a cross-jump tail-merge whose shared suffix is only slti; beqz.
That is too strong. Byte-proven counterexample: ov_SC03_110/func_801800F0 (and its three class copies
ov_SC05_001/func_80183A30, ov_SC03_112/func_80181D08, ov_SC03_108/func_8017FD64), the sign-split
|vx| < 0xB5, |vy| < 0x8D tests in if/else + goto TAIL form, score 0 with two __asm__ __volatile__("")
barriers (without them: 11 instructions short).
Placement is the whole lever (reorg stop_search_p, cookbook §5a addendum):
if (out.vx >= 0) {
if (out.vx >= 0xB5) goto TAIL;
__asm__ __volatile__(""); /* vx: AFTER the inner goto; target delay slots are nop */
} else { if (-out.vx >= 0xB5) goto TAIL; }
if (out.vy >= 0) {
if (out.vy >= 0x8D) {
__asm__ __volatile__(""); /* vy: INSIDE the inner if, before the goto */
goto TAIL;
}
} else { if (-out.vy >= 0x8D) goto TAIL; }
The vy join label begins with the division's lui $v0,0xB60B, which reorg steals into both incoming delay slots;
a barrier between the beqz and the j blocks that scan and yields beqz TAIL / nop / j CONT / lui instead of the
target's bnez CONT / lui / j TAIL / nop; so the vy barrier must sit before the goto, the vx one after it.
The lever-free spelling of §396(a) still holds and is preferred (0 levers):
if ((out.vx >= 0 ? out.vx < 0xB5 : -out.vx < 0xB5) && (out.vy >= 0 ? out.vy < 0x8D : -out.vy < 0x8D)) { … }.
abs() / (v >= 0 ? v : -v) < K cannot stand in: fold makes ABS_EXPR → abssi2 (bgez 1f; subu), other bytes.
So the corrected rule: the ternary condition is the lever-free fix; a barrier fixes it too, but only when placed
between the beqz and the j with respect to reorg's delay-slot fill.
Source: .run/P36/agents/ov_SC03_110__func_801800F0/mechanism.md (c),(f) and body_tree.c (scratch, P36 T7).