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.
This commit is contained in:
1
examples/platform/expected/1603-platform-stb-image.exit
Normal file
1
examples/platform/expected/1603-platform-stb-image.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
no image (expected in test)
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
--- build done ---
|
||||
build config: ok
|
||||
pointer size: 8
|
||||
os: macos
|
||||
64-bit platform
|
||||
1
examples/platform/expected/1605-platform-frameworks.exit
Normal file
1
examples/platform/expected/1605-platform-frameworks.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--- build done ---
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
--- build done ---
|
||||
runtime main
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
read: hello fs
|
||||
basename(/a/b/c.txt) = c.txt
|
||||
basename(foo) = foo
|
||||
dirname(/a/b/c.txt) = /a/b
|
||||
dirname(foo) = .
|
||||
ok
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
exit=0, stdout=hello world
|
||||
false exit=1
|
||||
unset var: null (ok)
|
||||
ls is absolute (ok)
|
||||
missing exec: null (ok)
|
||||
ok
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
--- build done ---
|
||||
ios-sim runtime main
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
target-host ok
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "x86_64-linux" }
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
6
examples/platform/expected/1639-platform-target-cross.ir
Normal file
6
examples/platform/expected/1639-platform-target-cross.ir
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
ret i32 0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
1
examples/platform/expected/1640-platform-asm-parse.build
Normal file
1
examples/platform/expected/1640-platform-asm-parse.build
Normal file
@@ -0,0 +1 @@
|
||||
{ "target": "x86_64-linux" }
|
||||
1
examples/platform/expected/1640-platform-asm-parse.exit
Normal file
1
examples/platform/expected/1640-platform-asm-parse.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
26
examples/platform/expected/1640-platform-asm-parse.ir
Normal file
26
examples/platform/expected/1640-platform-asm-parse.ir
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { i64, i64 } @divmod(i64 %0, i64 %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %0, ptr %alloca, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %1, ptr %allocaN, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%asm = call { i64, i64 } asm "divq ${4}", "={rax},={rdx},{rax},{rdx},r,~{cc}"(i64 %load, i64 0, i64 %loadN)
|
||||
ret { i64, i64 } %asm
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call { i64, i64 } @divmod(i64 17, i64 5)
|
||||
%tg = extractvalue { i64, i64 } %call, 0
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %tg, ptr %alloca, align 8
|
||||
%tgN = extractvalue { i64, i64 } %call, 1
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %tgN, ptr %allocaN, align 8
|
||||
ret i32 0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: asm expression with no outputs must be marked `volatile`
|
||||
--> examples/platform/1641-platform-asm-missing-volatile.sx:5:14
|
||||
|
|
||||
5 | nope :: () { asm { "nop" }; }
|
||||
| ^^^^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: redundant asm operand name `eax` — it already names the pinned register; drop the `[eax]`
|
||||
--> examples/platform/1643-platform-asm-echo-name.sx:5:25
|
||||
|
|
||||
5 | f :: () -> u32 { return asm volatile { "cpuid", [eax] "={eax}" -> u32, "{eax}" = 1 }; }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: duplicate asm operand name `x`
|
||||
--> examples/platform/1644-platform-asm-duplicate-name.sx:3:25
|
||||
|
|
||||
3 | f :: () -> u64 { return asm volatile { "nop", [x] "=r" -> u64, [x] "r" = 5 }; }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
21
examples/platform/expected/1645-platform-asm-aarch64-add.ir
Normal file
21
examples/platform/expected/1645-platform-asm-aarch64-add.ir
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal i64 @add_asm(i64 %0, i64 %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %0, ptr %alloca, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %1, ptr %allocaN, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%asm = call i64 asm "add ${0}, ${1}, ${2}", "=r,r,r"(i64 %load, i64 %loadN)
|
||||
ret i64 %asm
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @add_asm(i64 40, i64 2)
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
99
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%asm = call i64 asm "mov ${0}, #99", "=r"()
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %asm, ptr %alloca, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%ca.tr = trunc i64 %load to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
70
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { i64, i64 } @split(i64 %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %0, ptr %alloca, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%asm = call { i64, i64 } asm " and ${0}, ${2}, #0xff\0A lsr ${1}, ${2}, #8\0A", "=r,=r,r"(i64 %load)
|
||||
%tg = extractvalue { i64, i64 } %asm, 0
|
||||
%tgN = extractvalue { i64, i64 } %asm, 1
|
||||
%ti = insertvalue { i64, i64 } undef, i64 %tg, 0
|
||||
%tiN = insertvalue { i64, i64 } %ti, i64 %tgN, 1
|
||||
ret { i64, i64 } %tiN
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call { i64, i64 } @split(i64 4660)
|
||||
%tg = extractvalue { i64, i64 } %call, 0
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %tg, ptr %alloca, align 8
|
||||
%tgN = extractvalue { i64, i64 } %call, 1
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %tgN, ptr %allocaN, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%add = add i64 %load, %loadN
|
||||
%ca.tr = trunc i64 %add to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "aot": true, "target": "macos" }
|
||||
1
examples/platform/expected/1648-platform-asm-global.exit
Normal file
1
examples/platform/expected/1648-platform-asm-global.exit
Normal file
@@ -0,0 +1 @@
|
||||
42
|
||||
16
examples/platform/expected/1648-platform-asm-global.ir
Normal file
16
examples/platform/expected/1648-platform-asm-global.ir
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
module asm ".global _my_add"
|
||||
module asm "_my_add:"
|
||||
module asm " add x0, x0, x1"
|
||||
module asm " ret"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @my_add(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @my_add(i64 40, i64 2)
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
25
examples/platform/expected/1649-platform-asm-place-output.ir
Normal file
25
examples/platform/expected/1649-platform-asm-place-output.ir
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal i64 @compute() #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 0, ptr %alloca, align 8
|
||||
%asm = call { i64, i64 } asm sideeffect " mov ${0}, #5\0A mov ${1}, #37\0A", "=r,=r"()
|
||||
%asm.out = extractvalue { i64, i64 } %asm, 0
|
||||
%asm.out1 = extractvalue { i64, i64 } %asm, 1
|
||||
store i64 %asm.out1, ptr %alloca, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %asm.out, ptr %allocaN, align 8
|
||||
%load = load i64, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %alloca, align 8
|
||||
%add = add i64 %load, %loadN
|
||||
ret i64 %add
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @compute()
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
20
examples/platform/expected/1650-platform-asm-rw-place.ir
Normal file
20
examples/platform/expected/1650-platform-asm-rw-place.ir
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal i64 @compute() #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 41, ptr %alloca, align 8
|
||||
%asm.rw.seed = load i64, ptr %alloca, align 8
|
||||
%asm = call i64 asm sideeffect "add ${0}, ${0}, #1", "=r,0"(i64 %asm.rw.seed)
|
||||
store i64 %asm, ptr %alloca, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
ret i64 %load
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @compute()
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "x86_64-linux" }
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal i64 @sys_write(i64 %0, ptr %1, i64 %2) #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %0, ptr %alloca, align 8
|
||||
%allocaN = alloca ptr, align 8
|
||||
store ptr %1, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %2, ptr %allocaN, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%asm = call i64 asm sideeffect "syscall", "={rax},{rax},{rdi},{rsi},{rdx},~{rcx},~{r11},~{memory}"(i64 1, i64 %load, ptr %loadN, i64 %loadN)
|
||||
ret i64 %asm
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%alloca = alloca [3 x i8], align 1
|
||||
store [3 x i8] c"ok\0A", ptr %alloca, align 1
|
||||
%igp.ptr = getelementptr i8, ptr %alloca, i64 0
|
||||
%call = call i64 @sys_write(i64 1, ptr %igp.ptr, i64 3)
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 %call, ptr %allocaN, align 8
|
||||
ret i32 0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
18
examples/platform/expected/1652-platform-asm-indirect-mem.ir
Normal file
18
examples/platform/expected/1652-platform-asm-indirect-mem.ir
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal i64 @poke() #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 0, ptr %alloca, align 8
|
||||
call void asm sideeffect " mov x9, #42\0A str x9, ${0}\0A", "=*m,~{x9}"(ptr elementtype(i64) %alloca)
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
ret i64 %load
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @poke()
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
16
examples/platform/expected/1653-platform-asm-global-jit.ir
Normal file
16
examples/platform/expected/1653-platform-asm-global-jit.ir
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
module asm ".global _my_sub"
|
||||
module asm "_my_sub:"
|
||||
module asm " sub x0, x0, x1"
|
||||
module asm " ret"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @my_sub(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @my_sub(i64 44, i64 2)
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1 @@
|
||||
error: comptime init of 'COMPUTED' failed: comptime extern call: symbol not found via dlsym (target-specific binding called at compile time?)
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
42
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
module asm ".global _caller"
|
||||
module asm "_caller:"
|
||||
module asm " stp x29, x30, [sp, #-16]!"
|
||||
module asm " bl _cb // x0 = cb(x0) \E2\80\94 back into sx"
|
||||
module asm " ldp x29, x30, [sp], #16"
|
||||
module asm " ret"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i64 @cb(i64 %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca i64, align 8
|
||||
store i64 %0, ptr %alloca, align 8
|
||||
%load = load i64, ptr %alloca, align 8
|
||||
%add = add i64 %load, 1
|
||||
ret i64 %add
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @caller(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%call = call i64 @caller(i64 41)
|
||||
%ca.tr = trunc i64 %call to i32
|
||||
ret i32 %ca.tr
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user