aboutsummaryrefslogtreecommitdiff
path: root/test/cast-vm.qbe
diff options
context:
space:
mode:
Diffstat (limited to 'test/cast-vm.qbe')
-rw-r--r--test/cast-vm.qbe22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/cast-vm.qbe b/test/cast-vm.qbe
new file mode 100644
index 0000000..2ca3f7d
--- /dev/null
+++ b/test/cast-vm.qbe
@@ -0,0 +1,22 @@
+export
+function w $main() {
+@start.1
+ %.1 =l alloc4 4
+@body.2
+ storew 0, %.1
+ %.2 =w loadw %.1
+ %.3 =w add %.2, 1
+ storew %.3, %.1
+ %.4 =l extsw %.3
+ %.5 =l mul %.4, 4
+ %.6 =l extsw 0
+ %.7 =w loadw %.1
+ %.8 =w add %.7, 1
+ storew %.8, %.1
+ %.9 =l extsw %.8
+ %.10 =l mul %.9, 4
+ %.11 =l extsw 0
+ %.12 =w loadw %.1
+ %.13 =w cnew %.12, 2
+ ret %.13
+}