Skip to content

Commit 44bb15f

Browse files
a4lgAmanieu
authored andcommitted
reorder all RISC-V features for maintenance
All RISC-V Features are reordered for better maintainability. The author has a plan to add many RISC-V ratified extensions (mainly discoverable from Linux) and this is a part of preparation. Sections are divided as follows: * Base ISAs * "I"-related * Extensions formerly a part of the base "I" extension but divided later (now all of them are ratified). * Other user-mode extensions "Zi*". * "M"-related (currently "M" only) * "A"-related "A", "Za*" and "Ztso" which is named differently but absolutely related to memory operations. * Base FP extensions * Base FP extensions using integer registers * "C"-related (currently "C" only) * "B"-related (except cryptography-related "Zbk*") * Scalar cryptography extensions (including "Zbk*") * Base Vector extensions (currently "V" only) * Ratified privileged extensions * Non-extensions and non-ratified extensions which is *not* going to be ratified, at least in the draft form The last section needs some explanation. "S" is not an extension (although some buggy implementations such as QEMU up to 7.0 emitted this character as well as "U" as an extension) and the DeviceTree parser in the Linux kernel explicitly workarounds this issue. There's no plan for ratification of the single-letter "J" extension (there's a room for redefinition like the "B" extension but unlikely). Instead, pointer masking extensions including "Supm" is one of the results of the task group discussing J extension*s*. There's also an instruction in the "Zfa" extension which accelerates FP-to-int conversion matching JavaScript semantics. "P" is being actively discussed (and will result in a single-letter "P" extension and various "Zp*" extensions) but it seems there needs some time until ratification. And there's one Rust-specific issue: Rust implements Packed-SIMD intrinsics based on an early draft of the "P" extension and they are *very unlikely* kept as-is. For instance, `add16` does not follow standard RISC-V instruction naming (ADD16 is the name from the Andes' proposal) and going to be renamed. Before moving "P" to above, we have to clearly understand what the final "P" extension will be and resolve existing intrinsics.
1 parent 4529fb6 commit 44bb15f

File tree

1 file changed

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

1 file changed

+59
-51
lines changed

crates/std_detect/src/detect/arch/riscv.rs

+59-51
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,20 @@ features! {
8989
///
9090
/// [ISA manual]: https://github.com/riscv/riscv-isa-manual/
9191
#[stable(feature = "riscv_ratified", since = "1.78.0")]
92+
9293
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv32i: "rv32i";
9394
without cfg check: true;
9495
/// RV32I Base Integer Instruction Set
95-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zifencei: "zifencei";
96-
without cfg check: true;
97-
/// "Zifencei" Instruction-Fetch Fence
98-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zihintpause: "zihintpause";
96+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv32e: "rv32e";
9997
without cfg check: true;
100-
/// "Zihintpause" Pause Hint
98+
/// RV32E Base Integer Instruction Set
10199
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv64i: "rv64i";
102100
without cfg check: true;
103101
/// RV64I Base Integer Instruction Set
104-
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] m: "m";
105-
/// "M" Standard Extension for Integer Multiplication and Division
106-
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] a: "a";
107-
/// "A" Standard Extension for Atomic Instructions
102+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv128i: "rv128i";
103+
without cfg check: true;
104+
/// RV128I Base Integer Instruction Set
105+
108106
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zicsr: "zicsr";
109107
without cfg check: true;
110108
/// "Zicsr", Control and Status Register (CSR) Instructions
@@ -114,15 +112,37 @@ features! {
114112
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zihpm: "zihpm";
115113
without cfg check: true;
116114
/// "Zihpm", Standard Extension for Hardware Performance Counters
115+
116+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zifencei: "zifencei";
117+
without cfg check: true;
118+
/// "Zifencei" Instruction-Fetch Fence
119+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zihintpause: "zihintpause";
120+
without cfg check: true;
121+
/// "Zihintpause" Pause Hint
122+
123+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] m: "m";
124+
/// "M" Standard Extension for Integer Multiplication and Division
125+
126+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] a: "a";
127+
/// "A" Standard Extension for Atomic Instructions
128+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zam: "zam";
129+
without cfg check: true;
130+
/// "Zam" Standard Extension for Misaligned Atomics
131+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] ztso: "ztso";
132+
without cfg check: true;
133+
/// "Ztso" Standard Extension for Total Store Ordering
134+
117135
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] f: "f";
118136
/// "F" Standard Extension for Single-Precision Floating-Point
119137
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] d: "d";
120138
/// "D" Standard Extension for Double-Precision Floating-Point
121139
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] q: "q";
122140
without cfg check: true;
123141
/// "Q" Standard Extension for Quad-Precision Floating-Point
124-
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] c: "c";
125-
/// "C" Standard Extension for Compressed Instructions
142+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfh: "zfh";
143+
/// "Zfh" Standard Extension for 16-Bit Half-Precision Floating-Point
144+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfhmin: "zfhmin";
145+
/// "Zfhmin" Standard Extension for Minimal Half-Precision Floating-Point Support
126146
127147
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfinx: "zfinx";
128148
/// "Zfinx" Standard Extension for Single-Precision Floating-Point in Integer Registers
@@ -132,47 +152,9 @@ features! {
132152
/// "Zhinx" Standard Extension for Half-Precision Floating-Point in Integer Registers
133153
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zhinxmin: "zhinxmin";
134154
/// "Zhinxmin" Standard Extension for Minimal Half-Precision Floating-Point in Integer Registers
135-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] ztso: "ztso";
136-
without cfg check: true;
137-
/// "Ztso" Standard Extension for Total Store Ordering
138-
139-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv32e: "rv32e";
140-
without cfg check: true;
141-
/// RV32E Base Integer Instruction Set
142-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] rv128i: "rv128i";
143-
without cfg check: true;
144-
/// RV128I Base Integer Instruction Set
145-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfh: "zfh";
146-
/// "Zfh" Standard Extension for 16-Bit Half-Precision Floating-Point
147-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zfhmin: "zfhmin";
148-
/// "Zfhmin" Standard Extension for Minimal Half-Precision Floating-Point Support
149-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] j: "j";
150-
without cfg check: true;
151-
/// "J" Standard Extension for Dynamically Translated Languages
152-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] p: "p";
153-
without cfg check: true;
154-
/// "P" Standard Extension for Packed-SIMD Instructions
155-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] v: "v";
156-
/// "V" Standard Extension for Vector Operations
157-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zam: "zam";
158-
without cfg check: true;
159-
/// "Zam" Standard Extension for Misaligned Atomics
160155
161-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] s: "s";
162-
without cfg check: true;
163-
/// Supervisor-Level ISA
164-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svnapot: "svnapot";
165-
without cfg check: true;
166-
/// "Svnapot" Standard Extension for NAPOT Translation Contiguity
167-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svpbmt: "svpbmt";
168-
without cfg check: true;
169-
/// "Svpbmt" Standard Extension for Page-Based Memory Types
170-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svinval: "svinval";
171-
without cfg check: true;
172-
/// "Svinval" Standard Extension for Fine-Grained Address-Translation Cache Invalidation
173-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] h: "h";
174-
without cfg check: true;
175-
/// Hypervisor Extension
156+
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] c: "c";
157+
/// "C" Standard Extension for Compressed Instructions
176158
177159
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] zba: "zba";
178160
/// "Zba" Standard Extension for Address Generation Instructions
@@ -209,4 +191,30 @@ features! {
209191
/// "Zk" Standard Extension for Standard scalar cryptography extension
210192
@FEATURE: #[stable(feature = "riscv_ratified", since = "1.78.0")] zkt: "zkt";
211193
/// "Zkt" Standard Extension for Data Independent Execution Latency
194+
195+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] v: "v";
196+
/// "V" Standard Extension for Vector Operations
197+
198+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svnapot: "svnapot";
199+
without cfg check: true;
200+
/// "Svnapot" Standard Extension for NAPOT Translation Contiguity
201+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svpbmt: "svpbmt";
202+
without cfg check: true;
203+
/// "Svpbmt" Standard Extension for Page-Based Memory Types
204+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svinval: "svinval";
205+
without cfg check: true;
206+
/// "Svinval" Standard Extension for Fine-Grained Address-Translation Cache Invalidation
207+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] h: "h";
208+
without cfg check: true;
209+
/// Hypervisor Extension
210+
211+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] s: "s";
212+
without cfg check: true;
213+
/// Supervisor-Level ISA
214+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] j: "j";
215+
without cfg check: true;
216+
/// "J" Standard Extension for Dynamically Translated Languages
217+
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] p: "p";
218+
without cfg check: true;
219+
/// "P" Standard Extension for Packed-SIMD Instructions
212220
}

0 commit comments

Comments
 (0)