Skip to main content

Extension

Enum Extension 

Source
#[non_exhaustive]
pub enum Extension {
Show 86 variants E, M, A, F, D, Q, C, Zca, Zcf, Zcd, Zcmp, Zcmt, Zilsd, Zclsd, V, H, Zicsr, Zifencei, Zicond, Zalasr, Zacas, Zabha, Zawrs, Zicbom, Zicboz, Zicbop, Zihintntl, Zihintpause, Zimop, Zcmop, Zicfiss, Zicfilp, Zba, Zbb, Zbc, Zbs, Zbkb, Zbkc, Zbkx, Zknd, Zkne, Zknh, Zksed, Zksh, Zcb, Zfh, Zfhmin, Zfa, Zfbfmin, Zfinx, Zdinx, Zhinx, Zhinxmin, Zvfbfmin, Zvfbfwma, Zvbb, Zvbc, Zvkg, Zvkned, Zvknha, Zvknhb, Zvksed, Zvksh, Svinval, Sdext, Smrnmi, Ssctr, XTheadBa, XTheadBb, XTheadBs, XTheadCmo, XTheadCondMov, XTheadFMemIdx, XTheadFmv, XTheadInt, XTheadMac, XTheadMemIdx, XTheadMemPair, XTheadSync, XCValu, XCVbi, XCVbitmanip, XCVelw, XCVmac, XCVmem, XCVsimd,
}
Expand description

A RISC-V extension that defines instructions disc-v can decode.

Extensions that define no instructions, such as Zkt or Sstc, are not listed; Decoder::from_march accepts and ignores them.

The instructions of the vector and vendor extensions are only decoded with the vector, vendor-thead and vendor-corev Cargo features, which are on by default.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

E

The RV32E and RV64E bases: only registers x0-x15 exist, so instructions that use x16-x31 are reserved. This restricts the base ISA rather than adding instructions, so it is not in Extensions::DEFAULT.

§

M

Integer multiplication and division.

§

A

Atomic instructions.

§

F

Single-precision floating point.

§

D

Double-precision floating point. Implies F.

§

Q

Quad-precision floating point. Implies D.

§

C

Compressed instructions: Zca, and Zcf and Zcd when F and D are enabled.

§

Zca

Compressed integer instructions.

§

Zcf

Compressed single-precision loads and stores (RV32 only). Implies Zca and F.

§

Zcd

Compressed double-precision loads and stores. Implies Zca and D.

§

Zcmp

Compressed push, pop and register moves (cm.push, …). Implies Zca, and conflicts with Zcd.

§

Zcmt

Compressed table jumps (cm.jt, cm.jalt). Implies Zca and Zicsr, and conflicts with Zcd.

§

Zilsd

Load and store register pairs on RV32 (ld, sd).

§

Zclsd

Compressed load and store register pairs on RV32 (c.ld, c.sd, …). Implies Zilsd and Zca, and conflicts with Zcf.

§

V

Vectors.

§

H

The hypervisor extension.

§

Zicsr

Control and status register instructions.

§

Zifencei

fence.i.

§

Zicond

Integer conditional operations (czero.*).

§

Zalasr

Load-acquire and store-release (lw.aq, sw.rl, …).

§

Zacas

Atomic compare-and-swap (amocas.*). Implies A.

§

Zabha

Byte and halfword atomics (amoadd.b, …). Implies A.

§

Zawrs

Wait-on-reservation-set (wrs.*).

§

Zicbom

Cache-block management (cbo.clean, cbo.flush, cbo.inval).

§

Zicboz

Cache-block zero (cbo.zero).

§

Zicbop

Cache-block prefetch hints (prefetch.*).

§

Zihintntl

Non-temporal locality hints (ntl.*).

§

Zihintpause

The pause hint.

§

Zimop

May-be-operations (mop.r.N, mop.rr.N).

§

Zcmop

Compressed may-be-operations (c.mop.N). Implies C.

§

Zicfiss

Shadow stacks (sspush, sspopchk, ssrdp, ssamoswap.*). Implies Zimop.

§

Zicfilp

Landing pads (lpad).

§

Zba

Address generation (sh1add, …).

§

Zbb

Basic bit manipulation (andn, clz, …).

§

Zbc

Carry-less multiplication (clmul, …).

§

Zbs

Single-bit instructions (bset, …).

§

Zbkb

Bit manipulation for cryptography (pack, brev8, …). It also provides several Zbb instructions, such as rol and rev8.

§

Zbkc

Carry-less multiplication for cryptography: Zbc’s clmul and clmulh.

§

Zbkx

Crossbar permutations (xperm4, xperm8).

§

Zknd

AES decryption.

§

Zkne

AES encryption.

§

Zknh

SHA-256 and SHA-512.

§

Zksed

SM4.

§

Zksh

SM3.

§

Zcb

Simple compressed instructions (c.lbu, c.mul, …). Implies C.

§

Zfh

Half-precision floating point. Implies Zfhmin.

§

Zfhmin

Minimal half-precision floating point: loads, stores and conversions. Implies F.

§

Zfa

Additional floating-point instructions (fli, fround, …). Implies F.

§

Zfbfmin

Conversions between BFloat16 and single precision. Implies F.

§

Zfinx

Single-precision floating point in the integer registers: F’s instructions except its loads, stores and moves, with integer register operands. Conflicts with F (and so with the extensions that imply it, such as D, Zfa and C’s Zcf).

§

Zdinx

Double-precision floating point in the integer registers (register pairs on RV32). Implies Zfinx.

§

Zhinx

Half-precision floating point in the integer registers. Implies Zhinxmin.

§

Zhinxmin

Minimal half-precision floating point in the integer registers: the conversions. Implies Zfinx.

§

Zvfbfmin

Vector BFloat16 conversions. Implies V.

§

Zvfbfwma

Vector BFloat16 widening multiply-add. Implies Zvfbfmin.

§

Zvbb

Vector bit manipulation. Implies V.

§

Zvbc

Vector carry-less multiplication. Implies V.

§

Zvkg

Vector GCM/GMAC. Implies V.

§

Zvkned

Vector AES. Implies V.

§

Zvknha

Vector SHA-256. Implies V.

§

Zvknhb

Vector SHA-256 and SHA-512. Implies Zvknha, whose instructions it shares.

§

Zvksed

Vector SM4. Implies V.

§

Zvksh

Vector SM3. Implies V.

§

Svinval

Fine-grained address-translation cache invalidation (sinval.vma, …).

§

Sdext

Debug mode (dret).

§

Smrnmi

Resumable non-maskable interrupts (mnret).

§

Ssctr

Control-transfer records (sctrclr).

§

XTheadBa

T-Head address calculation (th.addsl).

§

XTheadBb

T-Head basic bit manipulation (th.ext, th.ff1, th.rev, …).

§

XTheadBs

T-Head single-bit test (th.tst).

§

XTheadCmo

T-Head cache management (th.dcache.*, th.icache.*, th.l2cache.*).

§

XTheadCondMov

T-Head conditional moves (th.mveqz, th.mvnez).

§

XTheadFMemIdx

T-Head indexed floating-point loads and stores (th.flrw, …). Implies F.

§

XTheadFmv

T-Head moves of the upper half of a double-precision register on RV32 (th.fmv.hw.x, th.fmv.x.hw). Implies D.

§

XTheadInt

T-Head interrupt register saving (th.ipush, th.ipop).

§

XTheadMac

T-Head multiply-accumulate (th.mula, …).

§

XTheadMemIdx

T-Head indexed loads and stores, and loads and stores that update the base register (th.lrw, th.lbia, …).

§

XTheadMemPair

T-Head load and store pairs (th.lwd, th.sdd, …).

§

XTheadSync

T-Head synchronization (th.sync, th.sfence.vmas, …).

§

XCValu

CORE-V ALU operations (cv.abs, cv.clip, cv.addn, …).

§

XCVbi

CORE-V branches with an immediate (cv.beqimm, cv.bneimm).

§

XCVbitmanip

CORE-V bit manipulation (cv.extract, cv.bset, cv.cnt, …).

§

XCVelw

CORE-V event load (cv.elw).

§

XCVmac

CORE-V multiply-accumulate (cv.mac, cv.mulsn, …).

§

XCVmem

CORE-V post-increment and register-offset loads and stores (cv.lw, cv.sw, …).

§

XCVsimd

CORE-V packed SIMD (cv.add.h, cv.dotsp.b, …).

Implementations§

Source§

impl Extension

Source

pub const fn name(self) -> &'static str

The extension’s name in an ISA string, such as "zba" or "m".

Source§

impl Extension

Source

pub fn from_name(name: &str) -> Option<Extension>

The extension named name in an ISA string, ignoring case.

Trait Implementations§

Source§

impl Clone for Extension

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Extension

Source§

impl Debug for Extension

Source§

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

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

impl Display for Extension

Source§

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

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

impl Eq for Extension

Source§

impl From<Extension> for Extensions

Source§

fn from(ext: Extension) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Extension> for Extensions

Source§

fn from_iter<I: IntoIterator<Item = Extension>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for Extension

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Extension

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Extension

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Extension

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Extension

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.