# Macro std::arch::is_riscv_feature_detected

source ·

    macro_rules! is_riscv_feature_detected {
        ("rv32i") => { ... };
        ("zifencei") => { ... };
        ("zihintpause") => { ... };
        ("rv64i") => { ... };
        ("m") => { ... };
        ("a") => { ... };
        ("zicsr") => { ... };
        ("zicntr") => { ... };
        ("zihpm") => { ... };
        ("f") => { ... };
        ("d") => { ... };
        ("q") => { ... };
        ("c") => { ... };
        ("zfinx") => { ... };
        ("zdinx") => { ... };
        ("zhinx") => { ... };
        ("zhinxmin") => { ... };
        ("ztso") => { ... };
        ("rv32e") => { ... };
        ("rv128i") => { ... };
        ("zfh") => { ... };
        ("zfhmin") => { ... };
        ("b") => { ... };
        ("j") => { ... };
        ("p") => { ... };
        ("v") => { ... };
        ("zam") => { ... };
        ("s") => { ... };
        ("svnapot") => { ... };
        ("svpbmt") => { ... };
        ("svinval") => { ... };
        ("h") => { ... };
        ("zba") => { ... };
        ("zbb") => { ... };
        ("zbc") => { ... };
        ("zbs") => { ... };
        ("zbkb") => { ... };
        ("zbkc") => { ... };
        ("zbkx") => { ... };
        ("zknd") => { ... };
        ("zkne") => { ... };
        ("zknh") => { ... };
        ("zksed") => { ... };
        ("zksh") => { ... };
        ("zkr") => { ... };
        ("zkn") => { ... };
        ("zks") => { ... };
        ("zk") => { ... };
        ("zkt") => { ... };
        ($t:tt,) => { ... };
        ($t:tt) => { ... };
    }

🔬This is a nightly-only experimental API. (`stdsimd` #27731)
Available on RISC-V RV32 or RISC-V RV64 only.
Expand description

A macro to test at runtime whether instruction sets are available on RISC-V platforms.

RISC-V standard defined the base sets and the extension sets. The base sets are RV32I, RV64I, RV32E or RV128I. Any RISC-V platform must support one base set and/or multiple extension sets.

Any RISC-V standard instruction sets can be in state of either ratified, frozen or draft. The version and status of current standard instruction sets can be checked out from preface section of the ISA manual.

Platform may define and support their own custom instruction sets with ISA prefix X. These sets are highly platform specific and should be detected with their own platform support crates.

## Unprivileged Specification

The supported ratified RISC-V instruction sets are as follows:

- RV32I: `"rv32i"`
- Zifencei: `"zifencei"`
- Zihintpause: `"zihintpause"`
- RV64I: `"rv64i"`
- M: `"m"`
- A: `"a"`
- Zicsr: `"zicsr"`
- Zicntr: `"zicntr"`
- Zihpm: `"zihpm"`
- F: `"f"`
- D: `"d"`
- Q: `"q"`
- C: `"c"`

There’s also bases and extensions marked as standard instruction set, but they are in frozen or draft state. These instruction sets are also reserved by this macro and can be detected in the future platforms.

Frozen RISC-V instruction sets:

- Zfinx: `"zfinx"`
- Zdinx: `"zdinx"`
- Zhinx: `"zhinx"`
- Zhinxmin: `"zhinxmin"`
- Ztso: `"ztso"`

Draft RISC-V instruction sets:

- RV32E: `"rv32e"`
- RV128I: `"rv128i"`
- Zfh: `"zfh"`
- Zfhmin: `"zfhmin"`
- B: `"b"`
- J: `"j"`
- P: `"p"`
- V: `"v"`
- Zam: `"zam"`

Defined by Privileged Specification:

- Supervisor: `"s"`
- Svnapot: `"svnapot"`
- Svpbmt: `"svpbmt"`
- Svinval: `"svinval"`
- Hypervisor: `"h"`

## RISC-V Bit-Manipulation ISA-extensions

This document defined the following extensions:

- Zba: `"zba"`
- Zbb: `"zbb"`
- Zbc: `"zbc"`
- Zbs: `"zbs"`

## RISC-V Cryptography Extensions

These extensions are defined in Volume I, Scalar & Entropy Source Instructions:

- Zbkb: `"zbkb"`
- Zbkc: `"zbkc"`
- Zbkx: `"zbkx"`
- Zknd: `"zknd"`
- Zkne: `"zkne"`
- Zknh: `"zknh"`
- Zksed: `"zksed"`
- Zksh: `"zksh"`
- Zkr: `"zkr"`
- Zkn: `"zkn"`
- Zks: `"zks"`
- Zk: `"zk"`
- Zkt: `"zkt"`