Skip to main content

Module sme

Module sme 

Source
Expand description

Encoder for the SME (Scalable Matrix Extension) group — the inverse of crate::decode::sme.

Gated behind #[cfg(feature = "sme")]. Without the feature the crate::encode::sme::encode stub returns crate::encode::EncodeError::Unsupported and is_sme reports false, so the default build still compiles. With it, every Sme* crate::mnemonic::Code the decoder produces is inverted: dispatch on crate::instruction::Instruction::code to a family encoder, read the operands the decoder pushed (the binja z-prefixed tile-slice spellings included), and pack the exact bitfields in reverse. It reconstructs the word purely from the instruction’s semantics — it never reads crate::instruction::Instruction::word. Total and panic-free.

SMSTART/SMSTOP are not handled here: they are MSR (immediate) PSTATE encodings owned by crate::encode::branch_sys (mirroring the decoder).

§Field layout recap (inverted from the decoder)

All SME reserved-region words have word<31> == 1, op0 == 0b0000, and are split by word<31:29>:

word<31:29>basefamily
1000x8000_0000outer-product FP/BF16
1010xA000_0000outer-product integer
1100xC000_0000MOVA / ADDHA / ADDVA
1110xE000_0000ZA load/store

Functions§

encodesme
Encode an SME instruction by inverting its decoder.
is_smesme
true for every Code produced by the SME decoder. (The Sme* enum variants exist regardless of the sme feature, so this is a plain match.)