aboutsummaryrefslogtreecommitdiff
path: root/examples/circle.hdass
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-31 23:14:26 +0200
committerhachem <im@hachem.wtf>2026-08-31 23:14:26 +0200
commit9dc06d01c2224ee1dbeb11ebee7c8afecfac8b05 (patch)
tree110fe30b5b1f228568087a8fe7b0f7e0ca43fbb1 /examples/circle.hdass
parent5b06b0e4b8effaacd23308d6a6b26c525e7d3af4 (diff)
feat: add support for floats through xmm registers
Diffstat (limited to 'examples/circle.hdass')
-rw-r--r--examples/circle.hdass17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/circle.hdass b/examples/circle.hdass
new file mode 100644
index 0000000..8a4edaa
--- /dev/null
+++ b/examples/circle.hdass
@@ -0,0 +1,17 @@
+[entry: main]
+
+// Floating-point math on the SSE registers. Computes the area of a circle
+// (pi * r * r) with r = 3, then exits with the truncated result (28).
+const SYS_EXIT = 60
+
+proc main
+{
+ xmm0 = 3.0 // radius
+ xmm0 *= xmm0 // r * r = 9.0
+ xmm1 = 3.14159 // pi
+ xmm0 *= xmm1 // area ~= 28.27
+
+ rdi = xmm0 // truncate to int -> 28
+ rax = SYS_EXIT
+ syscall
+}