x86 asm: start moving in binary arithmetic instructions

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-06 00:00:01 +00:00
parent 82129820ca
commit bc72790e81
4 changed files with 41 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
/* Decrement: i--. */
#include <lkmc.h>
LKMC_PROLOGUE
mov $3, %rax
dec %rax
LKMC_ASSERT_EQ_32(%rax, $2)
LKMC_EPILOGUE

View File

@@ -0,0 +1,9 @@
/* Increment: i++. */
#include <lkmc.h>
LKMC_PROLOGUE
mov $2, %eax
inc %eax
LKMC_ASSERT_EQ_32(%eax, $3)
LKMC_EPILOGUE

View File

@@ -0,0 +1,9 @@
/* Subtraction. */
#include <lkmc.h>
LKMC_PROLOGUE
mov $3, %rax
sub $2, %rax
LKMC_ASSERT_EQ(%rax, $1)
LKMC_EPILOGUE