Files
sx/examples/platform/1649-platform-asm-place-output.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
845 B
Plaintext

// ASM stream Phase 2 — `-> @place` write-through output. An asm result can be
// STORED through a place (a local / struct field) instead of returned: the
// place output does NOT join the result tuple. Here one value output is
// returned (into `main_val`) while a second is written through `@other`. The
// two are combined to 42. Read-write (`+`) and indirect (`*`) place outputs are
// not yet implemented (rejected at lowering). aarch64-pinned; ir-only elsewhere.
compute :: () -> i64 {
other : i64 = 0;
main_val := asm volatile {
#string ASM
mov %[m], #5
mov %[o], #37
ASM,
[m] "=r" -> i64, // value output → returned
[o] "=r" -> @other, // place output → stored through @other
};
return main_val + other; // 5 + 37 = 42
}
main :: () -> i64 { return compute(); }