From 6cad928374127b2fae65d7023fd31a725f4bd1d9 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Tue, 30 Jul 2019 00:48:00 +0100 Subject: [PATCH] Fix = codegen Use the sete instruction instead of the just plain wrong subtraction method --- codegen.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen.scm b/codegen.scm index 00e0129..c736773 100644 --- a/codegen.scm +++ b/codegen.scm @@ -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 -- 2.30.2