Skip to content

Commit b4c4a89

Browse files
committed
Stabilize Ratified RISC-V Target Features
As shortly discussed on Zulip (https://rust-lang.zulipchat.com/#narrow/stream/250483-t-compiler.2Frisc-v/topic/Stabilization.20of.20RISC-V.20Target.20Features/near/394793704), this commit stabilizes the ratified RISC-V instruction bases and extensions. Specifically, this commit stabilizes the: * Instruction-Fetch Fence (Zifencei) on v2.0 * Control and Status Register (Zcsr) on v2.0 * Pause Hint (Zihintpause) on v2.0 * Zicntr and Zihpm were ratified March 2023 * Supervisor-level Instructions (S) on v1.12 * Atomic Instructions (A) on v2.0 * Compressed Instructions (C) on v2.0 * Integer Multiplication and Division (M) on v2.0 * Bit Manipulations (B) on v1.0 listed as `zba`, `zbc`, `zbs` * Scalar Cryptography (Zk) v1.0.1 listed as `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, `zkt`, `zbkb`, `zbkc` `zkbx`
1 parent e504eff commit b4c4a89

File tree

1 file changed

+59
-70
lines changed
  • crates/std_detect/src/detect/arch

1 file changed

+59
-70
lines changed

Diff for: crates/std_detect/src/detect/arch/riscv.rs

+59-70
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,48 @@ features! {
2424
///
2525
/// The supported ratified RISC-V instruction sets are as follows:
2626
///
27+
/// * RV32E: `"rv32e"`
2728
/// * RV32I: `"rv32i"`
28-
/// * Zifencei: `"zifencei"`
29-
/// * Zihintpause: `"zihintpause"`
3029
/// * RV64I: `"rv64i"`
31-
/// * M: `"m"`
3230
/// * A: `"a"`
33-
/// * Zicsr: `"zicsr"`
34-
/// * Zicntr: `"zicntr"`
35-
/// * Zihpm: `"zihpm"`
36-
/// * F: `"f"`
31+
/// * B: `"b"`
32+
/// * Zba: `"zba"`
33+
/// * Zbb: `"zbb"`
34+
/// * Zbc: `"zbc"`
35+
/// * Zbs: `"zbs"`
36+
/// * C: `"c"`
3737
/// * D: `"d"`
38+
/// * F: `"f"`
39+
/// * M: `"m"`
3840
/// * Q: `"q"`
39-
/// * C: `"c"`
41+
/// * V: `"v"`
42+
/// * Zicntr: `"zicntr"`
43+
/// * Zicsr: `"zicsr"`
44+
/// * Zifencei: `"zifencei"`
45+
/// * Zihintpause: `"zihintpause"`
46+
/// * Zihpm: `"zihpm"`
47+
/// * Zk: `"zk"`
48+
/// * Zbkb: `"zbkb"`
49+
/// * Zbkc: `"zbkc"`
50+
/// * Zbkx: `"zbkx"`
51+
/// * Zkn: `"zkn"`
52+
/// * Zknd: `"zknd"`
53+
/// * Zkne: `"zkne"`
54+
/// * Zknh: `"zknh"`
55+
/// * Zkr: `"zkr"`
56+
/// * Zks: `"zks"`
57+
/// * Zksed: `"zksed"`
58+
/// * Zksh: `"zksh"`
59+
/// * Zkt: `"zkt"`
4060
///
4161
/// There's also bases and extensions marked as standard instruction set,
4262
/// but they are in frozen or draft state. These instruction sets are also
4363
/// reserved by this macro and can be detected in the future platforms.
4464
///
4565
/// Frozen RISC-V instruction sets:
4666
///
67+
/// * Zfh: `"zfh"`
68+
/// * Zfhmin: `"zfhmin"`
4769
/// * Zfinx: `"zfinx"`
4870
/// * Zdinx: `"zdinx"`
4971
/// * Zhinx: `"zhinx"`
@@ -52,14 +74,9 @@ features! {
5274
///
5375
/// Draft RISC-V instruction sets:
5476
///
55-
/// * RV32E: `"rv32e"`
5677
/// * RV128I: `"rv128i"`
57-
/// * Zfh: `"zfh"`
58-
/// * Zfhmin: `"zfhmin"`
59-
/// * B: `"b"`
6078
/// * J: `"j"`
6179
/// * P: `"p"`
62-
/// * V: `"v"`
6380
/// * Zam: `"zam"`
6481
///
6582
/// Defined by Privileged Specification:
@@ -70,61 +87,33 @@ features! {
7087
/// * Svinval: `"svinval"`
7188
/// * Hypervisor: `"h"`
7289
///
73-
/// # RISC-V Bit-Manipulation ISA-extensions
74-
///
75-
/// This document defined the following extensions:
76-
///
77-
/// * Zba: `"zba"`
78-
/// * Zbb: `"zbb"`
79-
/// * Zbc: `"zbc"`
80-
/// * Zbs: `"zbs"`
81-
///
82-
/// # RISC-V Cryptography Extensions
83-
///
84-
/// These extensions are defined in Volume I, Scalar & Entropy Source
85-
/// Instructions:
86-
///
87-
/// * Zbkb: `"zbkb"`
88-
/// * Zbkc: `"zbkc"`
89-
/// * Zbkx: `"zbkx"`
90-
/// * Zknd: `"zknd"`
91-
/// * Zkne: `"zkne"`
92-
/// * Zknh: `"zknh"`
93-
/// * Zksed: `"zksed"`
94-
/// * Zksh: `"zksh"`
95-
/// * Zkr: `"zkr"`
96-
/// * Zkn: `"zkn"`
97-
/// * Zks: `"zks"`
98-
/// * Zk: `"zk"`
99-
/// * Zkt: `"zkt"`
100-
///
10190
/// [ISA manual]: https://github.com/riscv/riscv-isa-manual/
10291
#[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")]
103-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv32i: "rv32i";
92+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] rv32i: "rv32i";
10493
/// RV32I Base Integer Instruction Set
105-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zifencei: "zifencei";
94+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zifencei: "zifencei";
10695
/// "Zifencei" Instruction-Fetch Fence
107-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zihintpause: "zihintpause";
96+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zihintpause: "zihintpause";
10897
/// "Zihintpause" Pause Hint
109-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv64i: "rv64i";
98+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] rv64i: "rv64i";
11099
/// RV64I Base Integer Instruction Set
111-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] m: "m";
100+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] m: "m";
112101
/// "M" Standard Extension for Integer Multiplication and Division
113-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] a: "a";
102+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] a: "a";
114103
/// "A" Standard Extension for Atomic Instructions
115-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zicsr: "zicsr";
104+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zicsr: "zicsr";
116105
/// "Zicsr", Control and Status Register (CSR) Instructions
117-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zicntr: "zicntr";
106+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zicntr: "zicntr";
118107
/// "Zicntr", Standard Extension for Base Counters and Timers
119-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zihpm: "zihpm";
108+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zihpm: "zihpm";
120109
/// "Zihpm", Standard Extension for Hardware Performance Counters
121110
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] f: "f";
122111
/// "F" Standard Extension for Single-Precision Floating-Point
123112
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] d: "d";
124113
/// "D" Standard Extension for Double-Precision Floating-Point
125114
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] q: "q";
126115
/// "Q" Standard Extension for Quad-Precision Floating-Point
127-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] c: "c";
116+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] c: "c";
128117
/// "C" Standard Extension for Compressed Instructions
129118
130119
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfinx: "zfinx";
@@ -146,7 +135,7 @@ features! {
146135
/// "Zfh" Standard Extension for 16-Bit Half-Precision Floating-Point
147136
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfhmin: "zfhmin";
148137
/// "Zfhmin" Standard Extension for Minimal Half-Precision Floating-Point Support
149-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] b: "b";
138+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] b: "b";
150139
/// "B" Standard Extension for Bit Manipulation
151140
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] j: "j";
152141
/// "J" Standard Extension for Dynamically Translated Languages
@@ -157,7 +146,7 @@ features! {
157146
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zam: "zam";
158147
/// "Zam" Standard Extension for Misaligned Atomics
159148
160-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] s: "s";
149+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] s: "s";
161150
/// Supervisor-Level ISA
162151
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svnapot: "svnapot";
163152
/// "Svnapot" Standard Extension for NAPOT Translation Contiguity
@@ -168,39 +157,39 @@ features! {
168157
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] h: "h";
169158
/// Hypervisor Extension
170159
171-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zba: "zba";
160+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zba: "zba";
172161
/// "Zba" Standard Extension for Address Generation Instructions
173-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbb: "zbb";
162+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbb: "zbb";
174163
/// "Zbb" Standard Extension for Basic Bit-Manipulation
175-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbc: "zbc";
164+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbc: "zbc";
176165
/// "Zbc" Standard Extension for Carry-less Multiplication
177-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbs: "zbs";
166+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbs: "zbs";
178167
/// "Zbs" Standard Extension for Single-Bit instructions
179168
180-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbkb: "zbkb";
169+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbkb: "zbkb";
181170
/// "Zbkb" Standard Extension for Bitmanip instructions for Cryptography
182-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbkc: "zbkc";
171+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbkc: "zbkc";
183172
/// "Zbkc" Standard Extension for Carry-less multiply instructions
184-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zbkx: "zbkx";
173+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zbkx: "zbkx";
185174
/// "Zbkx" Standard Extension for Crossbar permutation instructions
186-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zknd: "zknd";
175+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zknd: "zknd";
187176
/// "Zknd" Standard Extension for NIST Suite: AES Decryption
188-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zkne: "zkne";
177+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zkne: "zkne";
189178
/// "Zkne" Standard Extension for NIST Suite: AES Encryption
190-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zknh: "zknh";
179+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zknh: "zknh";
191180
/// "Zknh" Standard Extension for NIST Suite: Hash Function Instructions
192-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zksed: "zksed";
181+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zksed: "zksed";
193182
/// "Zksed" Standard Extension for ShangMi Suite: SM4 Block Cipher Instructions
194-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zksh: "zksh";
183+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zksh: "zksh";
195184
/// "Zksh" Standard Extension for ShangMi Suite: SM3 Hash Function Instructions
196-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zkr: "zkr";
185+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zkr: "zkr";
197186
/// "Zkr" Standard Extension for Entropy Source Extension
198-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zkn: "zkn";
187+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zkn: "zkn";
199188
/// "Zkn" Standard Extension for NIST Algorithm Suite
200-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zks: "zks";
189+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zks: "zks";
201190
/// "Zks" Standard Extension for ShangMi Algorithm Suite
202-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zk: "zk";
191+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zk: "zk";
203192
/// "Zk" Standard Extension for Standard scalar cryptography extension
204-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zkt: "zkt";
193+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.74.0")] zkt: "zkt";
205194
/// "Zkt" Standard Extension for Data Independent Execution Latency
206195
}

0 commit comments

Comments
 (0)