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.
21 lines
806 B
Plaintext
21 lines
806 B
Plaintext
// ASM stream Phase E — x86_64 multi-output asm: `divq` produces quotient in rax
|
|
// and remainder in rdx, returned as a `(quot, rem)` tuple. Two `={rax}`/`={rdx}`
|
|
// value outputs ⇒ LLVM returns a `{ i64, i64 }` struct, which IS sx's tuple
|
|
// representation (so `q, r := …` destructures it directly). x86-pinned via
|
|
// `.build`: ir-only on a non-x86 host (the `.ir` snapshot locks the struct
|
|
// return + `%[name]` rewrite); runs natively on x86_64-linux. See 1647 for a
|
|
// multi-output example that executes on aarch64.
|
|
divmod :: (n: u64, d: u64) -> (quot: u64, rem: u64) {
|
|
return asm {
|
|
"divq %[d]",
|
|
[quot] "={rax}" -> u64,
|
|
[rem] "={rdx}" -> u64,
|
|
"{rax}" = n, "{rdx}" = 0, [d] "r" = d,
|
|
clobbers(.cc),
|
|
};
|
|
}
|
|
|
|
main :: () {
|
|
q, r := divmod(17, 5);
|
|
}
|