pub struct Vex {
pub length: VexLength,
pub pp: Option<VexPrefix>,
pub mmmmm: Option<VexEscape>,
pub w: VexW,
pub opcode: u8,
pub modrm: Option<ModRmKind>,
pub imm: Imm,
pub is4: bool,
}
Expand description
The VEX encoding, introduced for AVX instructions.
// To encode a BLENDPD instruction in the manual: VEX.128.66.0F3A.WIG 0D /r ib
let enc = vex(L128)._66()._0f3a().wig().op(0x0D).r().ib();
assert_eq!(enc.to_string(), "VEX.128.66.0F3A.WIG 0x0D /r ib");
Fields§
§length: VexLength
The length of the operand (e.g., 128-bit or 256-bit).
pp: Option<VexPrefix>
Map the PP
field encodings.
mmmmm: Option<VexEscape>
Map the MMMMM
field encodings.
w: VexW
The W
bit.
opcode: u8
VEX-encoded instructions have a single-byte opcode. Other prefix-related
bytes (see Opcodes
) are encoded in the VEX prefixes (see pp
,
mmmmmm
). From the reference manual: “One (and only one) opcode byte
follows the 2 or 3 byte VEX.”
modrm: Option<ModRmKind>
See Rex.modrm
.
imm: Imm
See Rex.imm
.
is4: bool
See Vex::is4
Implementations§
Source§impl Vex
impl Vex
Sourcepub fn _66(self) -> Self
pub fn _66(self) -> Self
Set the pp
field to use VexPrefix::_66
; equivalent to .66
in the
manual.
Sourcepub fn _f2(self) -> Self
pub fn _f2(self) -> Self
Set the pp
field to use VexPrefix::_F2
; equivalent to .F2
in the
manual.
Sourcepub fn _f3(self) -> Self
pub fn _f3(self) -> Self
Set the pp
field to use VexPrefix::_F3
; equivalent to .F3
in the
manual.
Sourcepub fn _0f(self) -> Self
pub fn _0f(self) -> Self
Set the mmmmmm
field to use VexEscape::_0F
; equivalent to .0F
in
the manual.
Sourcepub fn _0f3a(self) -> Self
pub fn _0f3a(self) -> Self
Set the mmmmmm
field to use VexEscape::_0F3A
; equivalent to
.0F3A
in the manual.
Sourcepub fn _0f38(self) -> Self
pub fn _0f38(self) -> Self
Set the mmmmmm
field to use VexEscape::_0F38
; equivalent to
.0F38
in the manual.
Sourcepub fn ib(self) -> Self
pub fn ib(self) -> Self
Append a byte-sized immediate operand (8-bit); equivalent to ib
in the
reference manual.
§Panics
Panics if an immediate operand is already set.
Sourcepub fn iw(self) -> Self
pub fn iw(self) -> Self
Append a word-sized immediate operand (16-bit); equivalent to iw
in
the reference manual.
§Panics
Panics if an immediate operand is already set.
Sourcepub fn id(self) -> Self
pub fn id(self) -> Self
Append a doubleword-sized immediate operand (32-bit); equivalent to id
in the reference manual.
§Panics
Panics if an immediate operand is already set.
Sourcepub fn io(self) -> Self
pub fn io(self) -> Self
Append a quadword-sized immediate operand (64-bit); equivalent to io
in the reference manual.
§Panics
Panics if an immediate operand is already set.
Sourcepub fn digit(self, extension: u8) -> Self
pub fn digit(self, extension: u8) -> Self
Set the digit extending the opcode; equivalent to /<digit>
in the
reference manual.
§Panics
Panics if extension
is too large.
Sourcepub fn is4(self) -> Self
pub fn is4(self) -> Self
An 8-bit immediate byte is present containing a source register specifier in either imm8[7:4] (for 64-bit mode) or imm8[6:4] (for 32-bit mode), and instruction-specific payload in imm8[3:0].
Sourcepub fn unwrap_digit(&self) -> Option<u8>
pub fn unwrap_digit(&self) -> Option<u8>
Retrieve the digit extending the opcode, if available.