Files
sx/examples/platform/1652-platform-asm-indirect-mem.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

20 lines
757 B
Plaintext

// ASM stream — indirect-memory (`=*m`) place output. The place address is passed
// to the asm as a pointer and the asm writes THROUGH it (no return slot): here
// `str x9, %[out]` stores 42 into `x`'s storage directly. Distinct from a
// write-through `=` output (which returns a value that is then stored). Mixes a
// value output and an input below to exercise operand ordering. aarch64-pinned;
// ir-only elsewhere (the `.ir` locks the `=*m` constraint + `elementtype` attr).
poke :: () -> i64 {
x : i64 = 0;
asm volatile {
#string ASM
mov x9, #42
str x9, %[out]
ASM,
[out] "=*m" -> @x,
clobbers(.x9),
};
return x; // 42 — written through the pointer
}
main :: () -> i64 { return poke(); }