ref: 2919575e56322f30a83982e746071de149b9c863
parent: 0b81becf6915c7c54d266f8cc170fd8db58bb6a8
author: 9ferno <[email protected]>
date: Wed Dec 15 00:29:34 EST 2021
added cmp assembly tests
--- /dev/null
+++ b/tests/cmp.s
@@ -1,0 +1,27 @@
+
+/*
+: tests ; watch -e 'cmp.s$' 'mk 6.cmp && ./6.cmp; echo $status'
+*/
+
+TEXT main+0(SB),0,$16
+ MOVQ $20, BX
+ MOVQ $10, AX
+ CMPQ AX, BX
+/* if AX < BX then BX - AX > 0, no sign flag */
+ JLT .true
+ MOVQ $0, AX
+ JMP .exit
+.true:
+ MOVQ $9, AX
+.exit:
+ MOVQ $truemsg(SB), BP
+ CALL _exits+0(SB)
+ RET
+
+DATA truemsg+0(SB)/5, $"true\z"
+GLOBL truemsg(SB), $5
+DATA falsemsg+0(SB)/6, $"false\z"
+GLOBL falsemsg(SB), $6
+
+
+ END
--- a/tests/mkfile
+++ b/tests/mkfile
@@ -16,6 +16,8 @@
BIN=$ROOT/$OBJDIR/bin
-$O.asmconventions: asmconventions.$O asmconventions_asm.$O
+$O.asmconventions: asmconventions.$O asmconventions_asm.$O
+$O.cmp: cmp.$O
+ $LD -o $target /amd64/lib/libc.a $prereq
<$ROOT/mkfiles/mkmany-$SHELLTYPE