NDS、NDD、DDS在VEX指令编码中分别代表什么?
What do NDS, NDD, and DDS stand for in encoding VEX instructions?
来自 Intel's x86 manuals, Vol2,第 3.1.1.2 节:指令摘要中的操作码列 Table(带 VEX 前缀的指令)
NDS, NDD, DDS: specifies that VEX.vvvv field is valid for the encoding of a register operand:
- VEX.NDS: VEX.vvvv encodes the first source register in an instruction syntax where the content of source registers will be
preserved.
- VEX.NDD: VEX.vvvv encodes the destination register that cannot be encoded by ModR/M:reg field.
- VEX.DDS: VEX.vvvv encodes the second source register in a three-operand instruction syntax where the content of first source
register will be overwritten by the result.
我认为它与 "non-destructive source" 有关,我认为这就是 NDS 所代表的意思。其他代表什么,这如何影响指令的编码?同样,为什么它们甚至很重要 - 因为据我所知,AMD 手册不包含任何参考这些术语?
我没有看过 AMD 手册,但我认为他们选择了一些其他方式来指示哪个操作数由 VEX.vvvv
字段编码,以获取使用它的说明。
Intel 使用这个符号来提醒您/明确哪个操作数是 vvvv 字段。它已经是多余的,因为每个指令的 "Operand Encoding" table 显示哪个操作数在哪个字段中编码。
更新:英特尔可能在 2018 年 11 月的更新中将它们从手册中删除。它们也于 2018 年 10 月从 "future extensions" manual 修订版 035 中删除,该修订版具有与第 2 卷手册格式相同的说明列表,并且修订 table 他们提供了以下变更日志:
Removal of NDD/DDS/NDS terms from instructions. Note: Previously, the
terms NDS, NDD and DDS were used in instructions with an EVEX (or VEX)
prefix. These terms indicated that the vvvv field was valid for
encoding, and specified register usage. These terms are no longer
necessary and are redundant with the instruction operand encoding
tables provided with each instruction. The instruction operand
encoding tables give explicit details on all operands, indicating
where every operand is stored and if they are read or written. If vvvv
is not listed as an operand in the instruction operand encoding table,
then EVEX (or VEX) vvvv must be 0b1111.
所以这告诉我们那些 NDD/DDS/NDS 标签的目的是指示哪个操作数是哪个,以及它们是读还是写。
Non-Destructive Source 是手册同一卷中其他地方使用的短语(见下文),所以我非常有信心这是对 [=11 的正确解释=].
我认为 NDD
的明显解释是 非破坏性目标 (SSE2 版本的转变令人讨厌地具有破坏性)。
不清楚 DDS
应该代表什么。 "Destructive Destination-Source" 不适合,因为它是被覆盖的 other 源代码。
Intel manual vol2 第 2.3.5 节 VEX 前缀:
The bit fields of the VEX prefix can be summarized by its functional purposes:
- Non-destructive source register encoding (applicable to three and four operand syntax): This is the first source operand in the instruction syntax. VEX.vvvv.
(inverted: 1111 for xmm0, 0000 for xmm15。如后所述,反转避免与仅 32 位 LES
and LDS
(加载远指针)指令的有效编码重叠。32 位模式只能使用 xmm0 -7,因此第一位始终是必需的 1,因此它不是有效的 LES
/LDS
。)
是的,"Non Destructive source" 是英特尔手册中使用的短语。
第 2.3.6 节:指令操作数编码和 VEX.vvvv、ModR/M
Some VEX-encoded instructions have syntax with less than three
operands, e.g. VEX-encoded pack shift instructions support one source
operand and one destination operand).
The roles of VEX.vvvv, reg field of ModR/M byte (ModR/M.reg), r/m field of ModR/M byte (ModR/M.r/m) with
respect to encoding destination and source operands vary with different type of instruction syntax.
The role of VEX.vvvv can be summarized to three situations:
VEX.vvvv encodes the first source register operand, specified in inverted (1’s complement) form and is valid for
instructions with 2 or more source operands. (This is the NDS case)
VEX.vvvv encodes the destination register operand, specified in 1’s complement form for certain vector shifts.
The instructions where VEX.vvvv is used as a destination are listed in Table 2-9. The notation in the “Opcode”
column in Table 2-9 is described in detail in section 3.1.1. (The part quoted in the question)
- VEX.vvvv does not encode any operand (clearly not updated for the FMA
DDS
case).
有问题的向量移位是 VPS{R,L}L{W,D,Q}
、VPSRA{W,D,Q}
和 VPS{R,L}LDQ
(字节移位),它们使用 mod/rm
的 /r
字段作为额外的操作码位,例如一些单操作数整数指令(例如 and r/m32, imm8
)。例如
VEX.NDD.128.66.0F 73 /7 ib
VPSLLDQ
VEX.NDD.128.66.0F 73 /3 ib
VPSRLDQ
这就是 SSE 版本就地 bit/byte 轮班的原因,经常需要 movdqa 指令。 66 0F xx
SSE2 编码 space 中有一些免费的操作码,英特尔本可以使用这些操作码,而不是使这些常用指令具有破坏性。不过,我猜他们已经坚持使用 /r
字段作为 0F xx
MMX 版本的决定。我认为也没有必要让新的 SSE2 字节移位 insn 具有破坏性。至少他们设法进行了一次非破坏性洗牌,pshufd
。
来自 Intel's x86 manuals, Vol2,第 3.1.1.2 节:指令摘要中的操作码列 Table(带 VEX 前缀的指令)
NDS, NDD, DDS: specifies that VEX.vvvv field is valid for the encoding of a register operand:
- VEX.NDS: VEX.vvvv encodes the first source register in an instruction syntax where the content of source registers will be preserved.
- VEX.NDD: VEX.vvvv encodes the destination register that cannot be encoded by ModR/M:reg field.
- VEX.DDS: VEX.vvvv encodes the second source register in a three-operand instruction syntax where the content of first source register will be overwritten by the result.
我认为它与 "non-destructive source" 有关,我认为这就是 NDS 所代表的意思。其他代表什么,这如何影响指令的编码?同样,为什么它们甚至很重要 - 因为据我所知,AMD 手册不包含任何参考这些术语?
我没有看过 AMD 手册,但我认为他们选择了一些其他方式来指示哪个操作数由 VEX.vvvv
字段编码,以获取使用它的说明。
Intel 使用这个符号来提醒您/明确哪个操作数是 vvvv 字段。它已经是多余的,因为每个指令的 "Operand Encoding" table 显示哪个操作数在哪个字段中编码。
更新:英特尔可能在 2018 年 11 月的更新中将它们从手册中删除。它们也于 2018 年 10 月从 "future extensions" manual 修订版 035 中删除,该修订版具有与第 2 卷手册格式相同的说明列表,并且修订 table 他们提供了以下变更日志:
Removal of NDD/DDS/NDS terms from instructions. Note: Previously, the terms NDS, NDD and DDS were used in instructions with an EVEX (or VEX) prefix. These terms indicated that the vvvv field was valid for encoding, and specified register usage. These terms are no longer necessary and are redundant with the instruction operand encoding tables provided with each instruction. The instruction operand encoding tables give explicit details on all operands, indicating where every operand is stored and if they are read or written. If vvvv is not listed as an operand in the instruction operand encoding table, then EVEX (or VEX) vvvv must be 0b1111.
所以这告诉我们那些 NDD/DDS/NDS 标签的目的是指示哪个操作数是哪个,以及它们是读还是写。
Non-Destructive Source 是手册同一卷中其他地方使用的短语(见下文),所以我非常有信心这是对 [=11 的正确解释=].
我认为 NDD
的明显解释是 非破坏性目标 (SSE2 版本的转变令人讨厌地具有破坏性)。
不清楚 DDS
应该代表什么。 "Destructive Destination-Source" 不适合,因为它是被覆盖的 other 源代码。
Intel manual vol2 第 2.3.5 节 VEX 前缀:
The bit fields of the VEX prefix can be summarized by its functional purposes:
- Non-destructive source register encoding (applicable to three and four operand syntax): This is the first source operand in the instruction syntax. VEX.vvvv.
(inverted: 1111 for xmm0, 0000 for xmm15。如后所述,反转避免与仅 32 位 LES
and LDS
(加载远指针)指令的有效编码重叠。32 位模式只能使用 xmm0 -7,因此第一位始终是必需的 1,因此它不是有效的 LES
/LDS
。)
是的,"Non Destructive source" 是英特尔手册中使用的短语。
第 2.3.6 节:指令操作数编码和 VEX.vvvv、ModR/M
Some VEX-encoded instructions have syntax with less than three operands, e.g. VEX-encoded pack shift instructions support one source operand and one destination operand).
The roles of VEX.vvvv, reg field of ModR/M byte (ModR/M.reg), r/m field of ModR/M byte (ModR/M.r/m) with respect to encoding destination and source operands vary with different type of instruction syntax.
The role of VEX.vvvv can be summarized to three situations:
VEX.vvvv encodes the first source register operand, specified in inverted (1’s complement) form and is valid for instructions with 2 or more source operands. (This is the NDS case)
VEX.vvvv encodes the destination register operand, specified in 1’s complement form for certain vector shifts. The instructions where VEX.vvvv is used as a destination are listed in Table 2-9. The notation in the “Opcode” column in Table 2-9 is described in detail in section 3.1.1. (The part quoted in the question)
- VEX.vvvv does not encode any operand (clearly not updated for the FMA
DDS
case).
有问题的向量移位是 VPS{R,L}L{W,D,Q}
、VPSRA{W,D,Q}
和 VPS{R,L}LDQ
(字节移位),它们使用 mod/rm
的 /r
字段作为额外的操作码位,例如一些单操作数整数指令(例如 and r/m32, imm8
)。例如
VEX.NDD.128.66.0F 73 /7 ib
VPSLLDQ
VEX.NDD.128.66.0F 73 /3 ib
VPSRLDQ
这就是 SSE 版本就地 bit/byte 轮班的原因,经常需要 movdqa 指令。 66 0F xx
SSE2 编码 space 中有一些免费的操作码,英特尔本可以使用这些操作码,而不是使这些常用指令具有破坏性。不过,我猜他们已经坚持使用 /r
字段作为 0F xx
MMX 版本的决定。我认为也没有必要让新的 SSE2 字节移位 insn 具有破坏性。至少他们设法进行了一次非破坏性洗牌,pshufd
。