Files
sx/examples/platform/1658-platform-asm-x86-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

13 lines
629 B
Plaintext

// ASM stream — indirect-memory (`=*m`) place output on x86_64 (cross-arch sibling
// of the aarch64 1652). `movq $42, %[out]` stores straight through the place's
// address — the address is passed as an opaque `ptr` with an `elementtype(i64)`
// attribute, no return slot. Note `$42`: a literal `$` in the template is escaped
// to LLVM's `$$` and emitted back as `$42` (an x86 immediate). x86-pinned;
// ir-only here, runs on x86_64-linux.
poke :: () -> i64 {
x : i64 = 0;
asm volatile { "movq $42, %[out]", [out] "=*m" -> @x };
return x; // 42
}
main :: () -> i64 { if poke() != 42 { return 1; } return 0; }