且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

QWORD之后会发生什么?

更新时间:2023-11-09 22:20:10

TL:DR :在NASM中,在RESB/RESW/RESD/RESQ之后,有 RESO,RESY和RESZ .在指令助记符和Intel术语(在手册中使用)中,都使用O(十进制)和DQ(双四进制).但是不使用DQWORD,仅使用OWORD.

TL:DR: In NASM, after RESB/RESW/RESD/RESQ there's RESO, RESY, and RESZ. In instruction mnemonics and Intel terminology (used in manuals), O (oct) and DQ (double-quad) are both used. But DQWORD isn't used, only OWORD.

反汇编程序将对MASM或 .intel_syntax GNU语法的内存操作数显式大小使用 xmmword ptr [rsi] .IIRC,没有助记符和/或寄存器未暗示该大小的指令.

Disassemblers will use xmmword ptr [rsi] for memory operand explicit sizes in MASM or .intel_syntax GNU syntax. IIRC, there are no instructions where that size isn't already implied by the mnemonic and/or register.

请注意,此问题是x86特定的,并且与Intel的术语有关.在大多数其他ISA(如ARM或MIPS)中,单词"是指是32位,但是x86术语起源于8086.

Note that this question is x86-specific, and is about Intel's terminology. In most other ISAs (like ARM or MIPS), a "word" is 32 bits, but x86 terminology originated with 8086.

在某些x86-64指令的助记符中使用了十进制字.例如 CQO 符号将rax扩展为rdx:rax.

Octword is used in the mnemonics for some x86-64 instructions. e.g. CQO sign-extends rax into rdx:rax.

CMPXCHG16B 是另一种非矢量指令,可对16个字节进行操作,但英特尔不使用"oct"说明中的任何地方.取而代之的是,它们将内存位置描述为 m128 .该手动输入不使用任何基于单词"的大小.

CMPXCHG16B is another non-vector instruction that operates on 16 bytes, but Intel doesn't use "oct" anywhere in the description. Instead, they describe the memory location as a m128. That manual entry doesn't use any "word"-based sizes.

SSE/AVX整数指令通常具有元素大小作为助记符的一部分.在这种情况下,使用DQ(双四进制),而不使用O(八进制).例如, PUNPCKL * 指令将元素从一半插入两个源向量组成一个完整的目标向量:

SSE/AVX Integer instructions often have an element-size as part of the mnemonic. In that context, DQ (double-quad) is used, never O (oct). For example, the PUNPCKL* instructions that interleave elements from half of two source vectors into a full destination vector:

  • PUNPCKLWD:word-> dword(16-> 32)
  • PUNPCKLDQ:dword-> qword(32-> 64)
  • PUNPCKLQDQ:两个qwords->完整的128位寄存器(64-> 128).

但是,只有DQ,而不是DQWord .Double-Quadword听起来有些不自然,但我认为它有时可能会在Intel手册中使用.如果您忽略单词",而只是说在此位置存储一个四元组",听起来会更好.如果您想附加单词"对此,我认为只有OWord听起来很自然.

However, it's only ever DQ, not DQWord. Double-Quadword sounds somewhat unnatural, but I think it might be used in Intel manuals occasionally. It sounds better if you leave out the "Word", and just say "Store a Double-Quad at this location". If you want to attach "word" to it, I think only OWord sounds natural.

还有MOVDQA用于加载/存储/reg-reg移动.幸运的是,当AVX将向量宽度扩展到256b时,它们保留了相同的助记符,并且没有调用256b版本的VMOVQQA.

There's also MOVDQA for load/store/reg-reg moves. Mercifully, when AVX extended the vector width to 256b, they kept the same mnemonics and didn't call the 256b version VMOVQQA.

一些用于处理256位寄存器的128位通道的指令的名称中带有 128 ,例如

Some instructions for manipulating the 128-bit lanes of 256-bit registers have a 128 in the name, like VEXTRACTF128, which is new for Intel (other than CMPXCHG8B).

摘自NASM手册:

3.2.1数据库和朋友:声明初始化数据

使用DB,DW,DD,DQ,DT,DO,DY和DZ ...(示例表)

DB, DW, DD, DQ, DT, DO, DY and DZ are used ... (table of examples)

DO,DY和DZ不接受数字常量作为操作数.

DO, DY and DZ do not accept numeric constants as operands.

DT 是一个十字节的x87浮点数.DO是16个字节,DY是YMMWORD(32个字节),DZ是64个字节(AVX512 ZMM).由于它们不支持将数字常量用作初始值设定项,因此我猜您只能将它们与字符串文字初始化器一起使用吗?无论如何,对于DB/DW/DD/DQ来说,每个元素的初始值设定项以逗号分隔都是很正常的.

DT is a ten-byte x87 float. DO is 16 bytes, DY is a YMMWORD (32 bytes), and DZ is 64 bytes (AVX512 ZMM). Since they don't support numeric constants as initializers, I guess you could only use them with string literal initalizers? It would be more normal anyway to DB/DW/DD/DQ with a comma-separated list of per-element initializers.

类似地,您可以保留未初始化的空间.

Similarly, you can reserve uninitialized space.

realarray       resq    10              ; array of ten reals 
ymmval:         resy    1               ; one YMM register 
zmmvals:        resz    32              ; 32 ZMM registers


内部函数和AVX512的术语

正如我在


Terminology in intrinsics, and AVX512

As I mentioned in my answer on How can Microsoft say the size of a word in WinAPI is 16 bits?, AVX512's per-element masking during other operations makes naming tricky. VSHUFF32x4 shuffles 128b elements, with masking at 32bit element granularity.

但是,英特尔不是退出word = 16位.例如AVX512BW和AVX512DQ在名称中使用了该术语.一些内部函数甚至使用它们,以前它总是 epi32 ,而不是 d .(即 _mm256_broadcastd_epi32(__ m128i) _mm256_broadcastw_epi16(__ m128i).b/w/d/q完全多余.也许这是一个错误吗?)

However, Intel is not backing away from word=16 bits. e.g. AVX512BW and AVX512DQ put that terminology right in the name. Some intrinsics even use them, where previous it was always epi32, not d. (i.e. _mm256_broadcastd_epi32(__m128i), _mm256_broadcastw_epi16(__m128i). The b/w/d/q is totally redundant. Maybe that was a mistake?)

(其他人会发现asm助记符比烦人的长内在函数更容易记住和键入吗?您必须知道asm助记符才能读取编译器输出,因此,如果内在函数仅使用助记符而不是a第二种命名方案.)

(Does anyone else find the asm mnemonics easier to remember and type than the annoyingly-long intrinsics? You have to know the asm mnemonics to read compiler output, so it would be nice if the intrinsics just used the mnemonics instead of a second naming scheme.)