diff options
Diffstat (limited to 'testsuite/tests/asmgen/even-odd-spill.cmm')
| -rw-r--r-- | testsuite/tests/asmgen/even-odd-spill.cmm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/asmgen/even-odd-spill.cmm b/testsuite/tests/asmgen/even-odd-spill.cmm new file mode 100644 index 0000000000..0c5f05589c --- /dev/null +++ b/testsuite/tests/asmgen/even-odd-spill.cmm @@ -0,0 +1,19 @@ +("format_odd": string "odd %d\n\000") +("format_even": string "even %d\n\000") + +(function "force_spill" (a:int) 0) + +(function "is_even" (b:int) + (catch (exit even b) + with (odd v) + (if (== v 0) 0 + (seq + (extcall "printf_int" "format_odd" v unit) + (let v2 (- v 1) + (app "force_spill" 0 int) + (exit even v2)))) + and (even v) + (if (== v 0) 1 + (seq + (extcall "printf_int" "format_even" v unit) + (exit odd (- v 1)))))) |
