summaryrefslogtreecommitdiff
path: root/testsuite/tests/asmgen/even-odd.cmm
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-10-02 15:09:21 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2017-10-02 15:09:21 +0200
commit0d839d4b42ff28ab75667500c1a6d396276d0eb8 (patch)
tree3d253ccb349b6ac603e5fb0dcf481c0ceb672017 /testsuite/tests/asmgen/even-odd.cmm
parentb9709db3ff7cc9d6c30310899162a2c5a20fae2e (diff)
downloadocaml-tests_asmcomp_revised.tar.gz
Split tests/asmcomp into tests/asmgen and /tests/asmcomptests_asmcomp_revised
tests/asmgen contains the custom C-- code generator and the tests written in C-- tests/asmcomp contains the tests written in OCaml The purpose of this split is to make it easier to skip or remove entirely the asmgen tests in the future. Also: modernize the asm stubs in asmgen and remove the stubs for no-longer-supported architectures.
Diffstat (limited to 'testsuite/tests/asmgen/even-odd.cmm')
-rw-r--r--testsuite/tests/asmgen/even-odd.cmm8
1 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/tests/asmgen/even-odd.cmm b/testsuite/tests/asmgen/even-odd.cmm
new file mode 100644
index 0000000000..db79f1cab8
--- /dev/null
+++ b/testsuite/tests/asmgen/even-odd.cmm
@@ -0,0 +1,8 @@
+(function "is_even" (b:int)
+ (catch (exit even b)
+ with (odd v)
+ (if (== v 0) 0
+ (exit even (- v 1)))
+ and (even v)
+ (if (== v 0) 1
+ (exit odd (- v 1))))) \ No newline at end of file