aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-31 16:24:28 +0200
committerhachem <im@hachem.wtf>2026-08-31 16:24:28 +0200
commitf8a2d02c75df62f74e5907696d5a99a024d59018 (patch)
tree7f374fb0e408ea2dab15dc628b7bb6b0cee0d9e8 /examples
parentcaf904c9a8a30a44fb3fca6df93e97c5cabdb0c0 (diff)
feat: codegen for * and / in expressions and /= on any register
Diffstat (limited to 'examples')
-rw-r--r--examples/mul_div.hdass19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/mul_div.hdass b/examples/mul_div.hdass
new file mode 100644
index 0000000..8c813b6
--- /dev/null
+++ b/examples/mul_div.hdass
@@ -0,0 +1,19 @@
+[entry: main]
+
+// (7 * 6) / 5 = 8 with a value-expression multiply and a non-rax division,
+// returned as the exit status.
+const SYS_EXIT = 60
+
+proc main
+{
+ rbx = 7
+ rcx = 6
+ rbx = rbx * rcx // 42
+
+ rcx = 5
+ rbx /= rcx // 8
+
+ rdi = rbx
+ rax = SYS_EXIT
+ syscall
+}