Struct Vex

Source
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

Implementations§

Source§

impl Vex

Source

pub fn _66(self) -> Self

Set the pp field to use VexPrefix::_66; equivalent to .66 in the manual.

Source

pub fn _f2(self) -> Self

Set the pp field to use VexPrefix::_F2; equivalent to .F2 in the manual.

Source

pub fn _f3(self) -> Self

Set the pp field to use VexPrefix::_F3; equivalent to .F3 in the manual.

Source

pub fn _0f(self) -> Self

Set the mmmmmm field to use VexEscape::_0F; equivalent to .0F in the manual.

Source

pub fn _0f3a(self) -> Self

Set the mmmmmm field to use VexEscape::_0F3A; equivalent to .0F3A in the manual.

Source

pub fn _0f38(self) -> Self

Set the mmmmmm field to use VexEscape::_0F38; equivalent to .0F38 in the manual.

Source

pub fn w0(self) -> Self

Set the W bit to 0; equivalent to .W0 in the manual.

Source

pub fn w1(self) -> Self

Set the W bit to 1; equivalent to .W1 in the manual.

Source

pub fn wig(self) -> Self

Ignore the W bit; equivalent to .WIG in the manual.

Source

pub fn op(self, opcode: u8) -> Self

Set the single opcode for this VEX-encoded instruction.

Source

pub fn r(self) -> Self

Set the ModR/M byte to contain a register operand; see Rex::r.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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].

Source

pub fn unwrap_digit(&self) -> Option<u8>

Retrieve the digit extending the opcode, if available.

Trait Implementations§

Source§

impl Display for Vex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Vex> for Encoding

Source§

fn from(vex: Vex) -> Encoding

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Vex

§

impl RefUnwindSafe for Vex

§

impl Send for Vex

§

impl Sync for Vex

§

impl Unpin for Vex

§

impl UnwindSafe for Vex

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.