Fix = codegen
authorLuke Lau <luke_lau@icloud.com>
Mon, 29 Jul 2019 23:48:00 +0000 (00:48 +0100)
committerLuke Lau <luke_lau@icloud.com>
Mon, 29 Jul 2019 23:48:00 +0000 (00:48 +0100)
Use the sete instruction instead of the just plain wrong subtraction
method

codegen.scm

index 00e01296af20661539f8fda3d882c6fa39547092..c73677325f899e064200b678182e6290d9fe6b2d 100644 (file)
@@ -46,9 +46,9 @@
   (codegen-expr a si env)
   (emit "movq %rax, ~a(%rbp)" si)
   (codegen-expr b (- si wordsize) env)
-  (emit "subq ~a(%rbp), %rax" si)
-  (emit "not %rax")
-  (emit "andq $1, %rax"))
+  (emit "## ~a = ~b" a b)
+  (emit "cmpq ~a(%rbp), %rax" si)
+  (emit "sete %al"))
 
                                        ; 'write file handle addr-string num-bytes