Add wasm2elf: i32 WebAssembly to static x86-64 ELF compiler in MoonBit

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-21 00:53:04 -08:00
commit b8617c7aaa
22 files changed
+1219

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
;; select, tee, rem_s, shifts, early return, nested blocks with results: -> 42
(module
(func $pick (param $a i32) (param $b i32) (param $c i32) (result i32)
(select (local.get $a) (local.get $b) (local.get $c)))
(func (export "main") (result i32)
(local $x i32)
(local.set $x (i32.rem_s (i32.const -7) (i32.const 3))) ;; -1
(if (i32.ne (local.get $x) (i32.const -1)) (then (return (i32.const 1))))
(if (i32.ne (i32.shr_u (i32.const -1) (i32.const 28)) (i32.const 15)) (then (return (i32.const 2))))
(if (i32.ne (call $pick (i32.const 10) (i32.const 20) (i32.const 0)) (i32.const 20)) (then (return (i32.const 3))))
(if (i32.ne (call $pick (i32.const 10) (i32.const 20) (i32.const 1)) (i32.const 10)) (then (return (i32.const 4))))
(i32.add
(block (result i32)
(drop (i32.const 99))
(br 0 (i32.const 40)))
(local.tee $x (i32.const 2)))))