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

@@ -11756,6 +11756,9 @@ The first examples you should look into are:
** <<x86-addressing-modes>> ** <<x86-addressing-modes>>
** <<arm-addressing-modes>> ** <<arm-addressing-modes>>
* registers: <<assembly-registers>> * registers: <<assembly-registers>>
* SIMD
** <<x86-simd>>
** <<arm-simd>>
The add examples in particular: The add examples in particular:
@@ -12320,6 +12323,15 @@ Bibliography:
* <<intel-manual-1>> 3.7.5 "Specifying an Offset" * <<intel-manual-1>> 3.7.5 "Specifying an Offset"
* https://sourceware.org/binutils/docs-2.18/as/i386_002dMemory.html * https://sourceware.org/binutils/docs-2.18/as/i386_002dMemory.html
=== x86 binary arithmetic instructions
<<intel-manual-1>> 5.1.2 "Binary Arithmetic Instructions":
* link:userland/arch/x86_64/add.S[ADD]
* link:userland/arch/x86_64/dec.S[DEC]
* link:userland/arch/x86_64/inc.S[INC]
* link:userland/arch/x86_64/sub.S[SUB]
=== x86 SIMD === x86 SIMD
History: History:
@@ -12411,12 +12423,12 @@ Userland basics: http://web.archive.org/web/20190606075544/https://software.inte
Instruction list: http://web.archive.org/web/20190606075330/https://software.intel.com/sites/default/files/managed/a4/60/325383-sdm-vol-2abcd.pdf Instruction list: http://web.archive.org/web/20190606075330/https://software.intel.com/sites/default/files/managed/a4/60/325383-sdm-vol-2abcd.pdf
[[intel-manual-3]] [[intel-manual-3]]
====== Intel 64 and IA-32 Architectures Software Developer's Manuals Volume 2 ====== Intel 64 and IA-32 Architectures Software Developer's Manuals Volume 3
Kernel land: http://web.archive.org/web/20190606075534/https://software.intel.com/sites/default/files/managed/a4/60/325384-sdm-vol-3abcd.pdf Kernel land: http://web.archive.org/web/20190606075534/https://software.intel.com/sites/default/files/managed/a4/60/325384-sdm-vol-3abcd.pdf
[[intel-manual-4]] [[intel-manual-4]]
====== Intel 64 and IA-32 Architectures Software Developer's Manuals Volume 2 ====== Intel 64 and IA-32 Architectures Software Developer's Manuals Volume 4
Model specific extensions: http://web.archive.org/web/20190606075325/https://software.intel.com/sites/default/files/managed/22/0d/335592-sdm-vol-4.pdf Model specific extensions: http://web.archive.org/web/20190606075325/https://software.intel.com/sites/default/files/managed/22/0d/335592-sdm-vol-4.pdf

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