neg 在哪里存储颠倒的数字?
Where does neg store the reversed number?
我正在看一本关于 FASM 汇编器的 x86 汇编的书,介绍了下面这句话:
neg subtracts a signed integer operand from zero. The effect of this
instructon is to reverse the sign of the operand from positive to
negative or from negative to positive.
它从 0
中减去操作数,所以如果我有 6 ,(0-6=-6)
如果我有 -6 (0-(-6)=6)
现在,它把颠倒的数字保存在哪里?在给定的操作数中?书上没有再说了,所以在这里我想知道如果我们不能存储它的目的是什么
是的,在给定的操作数中。可以看到 in Intel's x86 instruction manual:
NEG
Replaces the value of operand (the destination operand) with its two's complement. (This operation is equivalent to subtracting the operand from 0.) The destination operand is located in a general-purpose register or a memory location
是的,目的地是一样的
也可能是内存位置
我认为这本书的作者假设它显然存储在某个地方,唯一合乎逻辑的地方是回到给定的操作数,比如 INC / DEC 和 NOT。
正如你所说,如果它不存储在任何地方,它就没有多大意义。
并且您的书大概不是要成为 ISA 参考手册; Intel 和 AMD 发布了这些内容(以 PDF 格式免费提供),您应该在不确定此类内容时随时查阅它们。
请参阅 https://whosebug.com/tags/x86/info 以获取文档链接。
- HTML 英特尔第 2 卷手册摘录http://www.felixcloutier.com/x86/, e.g.
neg
。
An older extract of Intel's manual, from before they added SSE2 or x86-64 so it's much less cluttered. neg
有
https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html Intel 的官方 PDF,HTML 页以上的内容是从中删除的。
- https://developer.amd.com/resources/developer-guides-manuals/. AMD's equivalent. Note some fun differences like AMD documenting that
bsf
/ bsr
leave the destination unmodified when the source is 0
, which Intel just does it but documents it as undefined. See also https://en.wikipedia.org/wiki/X86-64#Differences_between_AMD64_and_Intel_64
我正在看一本关于 FASM 汇编器的 x86 汇编的书,介绍了下面这句话:
neg subtracts a signed integer operand from zero. The effect of this instructon is to reverse the sign of the operand from positive to negative or from negative to positive.
它从 0
中减去操作数,所以如果我有 6 ,(0-6=-6)
如果我有 -6 (0-(-6)=6)
现在,它把颠倒的数字保存在哪里?在给定的操作数中?书上没有再说了,所以在这里我想知道如果我们不能存储它的目的是什么
是的,在给定的操作数中。可以看到 in Intel's x86 instruction manual:
NEG
Replaces the value of operand (the destination operand) with its two's complement. (This operation is equivalent to subtracting the operand from 0.) The destination operand is located in a general-purpose register or a memory location
是的,目的地是一样的
也可能是内存位置
我认为这本书的作者假设它显然存储在某个地方,唯一合乎逻辑的地方是回到给定的操作数,比如 INC / DEC 和 NOT。
正如你所说,如果它不存储在任何地方,它就没有多大意义。
并且您的书大概不是要成为 ISA 参考手册; Intel 和 AMD 发布了这些内容(以 PDF 格式免费提供),您应该在不确定此类内容时随时查阅它们。
请参阅 https://whosebug.com/tags/x86/info 以获取文档链接。
- HTML 英特尔第 2 卷手册摘录http://www.felixcloutier.com/x86/, e.g.
neg
。 An older extract of Intel's manual, from before they added SSE2 or x86-64 so it's much less cluttered.
neg
有https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html Intel 的官方 PDF,HTML 页以上的内容是从中删除的。
- https://developer.amd.com/resources/developer-guides-manuals/. AMD's equivalent. Note some fun differences like AMD documenting that
bsf
/bsr
leave the destination unmodified when the source is0
, which Intel just does it but documents it as undefined. See also https://en.wikipedia.org/wiki/X86-64#Differences_between_AMD64_and_Intel_64