about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-17 16:42:28 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:50 -0700
commit694078b52022ad359b6021448200dbbcca5c222e (patch)
tree631d42b44a742f3778166bf76c6ceb3c65adffe7 /apps
parentbfa972754c66179766398d9405da2d44c2c0f5f3 (diff)
downloadmu-694078b52022ad359b6021448200dbbcca5c222e.tar.gz
mu.subx: test-compare-mem-with-reg
Diffstat (limited to 'apps')
-rw-r--r--apps/mu.subx87
1 files changed, 65 insertions, 22 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index e16bbf30..4fdd1598 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -9353,6 +9353,7 @@ _Primitive-subtract-lit-from-reg:  # (payload primitive)
     1/imm32/imm32-is-first-inout
     0/imm32/no-disp32
     0/imm32/output-is-write-only
+    0x11/imm32/alloc-id:fake
     _Primitive-subtract-lit-from-mem/imm32/next
 _Primitive-subtract-lit-from-mem:  # (payload primitive)
     0x11/imm32/alloc-id:fake:payload
@@ -13307,7 +13308,7 @@ $test-add-reg-to-mem:initialize-stmt:
     68/push 1/imm32/tag:stmt1
     89/<- %esi 4/r32/esp
 $test-add-reg-to-mem:initialize-stmt-operation:
-    # stmt->operation = "add"
+    # stmt->operation = "add-to"
     8d/copy-address *(esi+4) 0/r32/eax  # Stmt1-operation
     (copy-array Heap "add-to" %eax)
     # convert
@@ -13788,42 +13789,84 @@ test-compare-mem-with-reg:
     # setup
     (clear-stream _test-output-stream)
     (clear-stream $_test-output-buffered-file->buffer)
-    # var type/ecx: (handle tree type-id) = int
-    68/push 0/imm32/right/null
-    68/push 1/imm32/left/int
-    68/push 1/imm32/is-atom
+$test-compare-mem-with-reg:initialize-type:
+    # var type/ecx: (payload tree type-id) = int
+    68/push 0/imm32/right:null
+    68/push 0/imm32/right:null
+    68/push 0/imm32/left:unused
+    68/push 1/imm32/value:int
+    68/push 1/imm32/is-atom?:true
+    68/push 0x11/imm32/alloc-id:fake:payload
     89/<- %ecx 4/r32/esp
-    # var var-var2/ecx: var in eax
-    68/push "eax"/imm32/register
-    68/push 0/imm32/no-stack-offset
+$test-compare-mem-with-reg:initialize-var1:
+    # var var1/ecx: (payload var)
+    68/push 0/imm32/register
+    68/push 0/imm32/register
+    68/push 8/imm32/stack-offset
     68/push 1/imm32/block-depth
     51/push-ecx
-    68/push "var2"/imm32
+    68/push 0x11/imm32/alloc-id:fake
+    68/push 0/imm32/name
+    68/push 0/imm32/name
+    68/push 0x11/imm32/alloc-id:fake:payload
     89/<- %ecx 4/r32/esp
-    # var var-var1/edx: var
-    68/push 0/imm32/no-register
-    68/push 8/imm32/stack-offset
+$test-compare-mem-with-reg:initialize-var1-name:
+    # var1->name = "var1"
+    8d/copy-address *(ecx+4) 0/r32/eax  # Var-name + 4
+    (copy-array Heap "var1" %eax)
+$test-compare-mem-with-reg:initialize-var2:
+    # var var2/edx: (payload var)
+    68/push 0/imm32/register
+    68/push 0/imm32/register
+    68/push 0/imm32/no-stack-offset
     68/push 1/imm32/block-depth
-    ff 6/subop/push *(ecx+4)  # Var-type
-    68/push "var1"/imm32
+    ff 6/subop/push *(ecx+0x10)
+    68/push 0x11/imm32/alloc-id:fake
+    68/push 0/imm32/name
+    68/push 0/imm32/name
+    68/push 0x11/imm32/alloc-id:fake:payload
     89/<- %edx 4/r32/esp
-    # var inouts/esi: (handle stmt-var) = [var2]
+$test-compare-mem-with-reg:initialize-var2-name:
+    # var2->name = "var2"
+    8d/copy-address *(edx+4) 0/r32/eax  # Var-name + 4
+    (copy-array Heap "var2" %eax)
+$test-compare-mem-with-reg:initialize-var2-register:
+    # var2->register = "eax"
+    8d/copy-address *(edx+0x1c) 0/r32/eax  # Var-register + 4
+    (copy-array Heap "eax" %eax)
+$test-compare-mem-with-reg:initialize-inouts:
+    # var inouts/esi: (payload stmt-var) = [var2]
     68/push 0/imm32/is-deref:false
     68/push 0/imm32/next
-    51/push-ecx/var-var2
+    68/push 0/imm32/next
+    52/push-edx/var2
+    68/push 0x11/imm32/alloc-id:fake
+    68/push 0x11/imm32/alloc-id:fake:payload
     89/<- %esi 4/r32/esp
     # inouts = [var1, var2]
     68/push 0/imm32/is-deref:false
-    56/push-esi
-    52/push-edx/var-var1
+    56/push-esi/next
+    68/push 0x11/imm32/alloc-id:fake
+    51/push-ecx/var1
+    68/push 0x11/imm32/alloc-id:fake
+    68/push 0x11/imm32/alloc-id:fake:payload
     89/<- %esi 4/r32/esp
-    # var stmt/esi: statement
+$test-compare-mem-with-reg:initialize-stmt:
+    # var stmt/esi: (addr statement)
     68/push 0/imm32/next
-    68/push 0/imm32/no-outputs
+    68/push 0/imm32/next
+    68/push 0/imm32/outputs
+    68/push 0/imm32/outputs
     56/push-esi/inouts
-    68/push "compare"/imm32/operation
-    68/push 1/imm32
+    68/push 0x11/imm32/alloc-id:fake
+    68/push 0/imm32/operation
+    68/push 0/imm32/operation
+    68/push 1/imm32/tag:stmt1
     89/<- %esi 4/r32/esp
+$test-compare-mem-with-reg:initialize-stmt-operation:
+    # stmt->operation = "compare"
+    8d/copy-address *(esi+4) 0/r32/eax  # Stmt1-operation
+    (copy-array Heap "compare" %eax)
     # convert
     c7 0/subop/copy *Curr-block-depth 0/imm32
     (emit-subx-stmt _test-output-buffered-file %esi Primitives)