//! Raw SME / SSVE instruction encoding via inline assembly.
//!
//! Stable Rust 1.95 does not let crates enable +sme target features, so
//! every SME / SSVE instruction is emitted via `.word` in inline asm โ
//! the same trick used for the undocumented AMX path.
//!
//! Encodings verified against `llvm-mc -mattr=+sme,+sme2 -show-encoding`.
// ---------------------------------------------------------------------------
// Streaming-mode lifecycle
// ---------------------------------------------------------------------------
/// SMSTART (full): set PSTATE.SM = 1 and PSTATE.ZA = 1.
///
/// # Safety
///
/// FEAT_SME must be present on the running CPU. On chips without SME,
/// this is an illegal instruction and will SIGILL. Probe via
/// [`crate::probe::scan`] before calling.
pub unsafe
/// SMSTOP (full): clear PSTATE.SM and PSTATE.ZA.
///
/// # Safety
///
/// Must follow an SMSTART on the same thread. Calling SMSTOP outside
/// streaming mode is a no-op on PSTATE but still a privileged form of
/// MSR; on FEAT_SME chips it is always legal.
pub unsafe
/// SMSTART SM: enter streaming SVE mode without enabling ZA.
pub unsafe
/// SMSTOP SM: leave streaming SVE mode.
pub unsafe
/// SMSTART ZA: enable the ZA matrix accumulator.
pub unsafe
/// SMSTOP ZA: disable the ZA matrix accumulator.
pub unsafe
// ---------------------------------------------------------------------------
// RDSVL โ read streaming vector length
// ---------------------------------------------------------------------------
/// `RDSVL X0, #1` โ returns SVL in bytes via X0.
///
/// Encoded as `.word 0x04BF5820`. Only valid inside streaming mode.
///
/// # Safety
///
/// Caller must already be inside streaming mode (i.e. a live `Stream`).
/// Clobbers X0; the value flows out through inline asm's `out("x0")`.
pub unsafe
// ---------------------------------------------------------------------------
// ZERO {ZA}
// ---------------------------------------------------------------------------
/// `ZERO {ZA}` โ clear the entire ZA accumulator.
///
/// Encoded as `.word 0xC00800FF`. PSTATE.ZA must be 1.
///
/// # Safety
///
/// Caller must be inside streaming mode with ZA enabled.
pub unsafe