Skip to content

Commit 19c9b76

Browse files
authored
Rollup merge of #140507 - a4lg:riscv-feature-addition-batch-3, r=Amanieu
rustc_target: RISC-V: feature addition batch 3 This is the last batch (3 of 3) for RISC-V feature enhancements intended for the version 1.88 cycle. The author's primary criteria are: 1. The extension is ratified and unprivileged one. 2. The extension is in the RVA23U64 profile (to be a baseline of the application-class RISC-V software ecosystem in the near future), either mandatory or optional. 3. Either: 1. To be discoverable through a `riscv_hwprobe` system call on (currently unreleased) Linux 6.15 (as of rc4) or 2. Helps memory/atomics-related operations more efficient and/or more robust. This is based on the specifications: * [The latest ratified ISA Manuals (version 20240411)](https://lf-riscv.atlassian.net/wiki/spaces/HOME/pages/16154769/RISC-V+Technical+Specifications) * [RVA23/RVB23 profiles](https://github.com/riscv/riscv-profiles/releases/tag/rva23-rvb23-ratified) * [RISC-V BF16 extensions](https://github.com/riscv/riscv-bfloat16/releases/tag/v183a3dac863d7c18187a739eb52b0c8f0d16854d) LLVM Definitions: * [`Zicbop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L82-87) * [`Zicbom`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L75-L80) * [`Zic64b`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L71-L73) * [`Ziccamoa`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L97-L99) * [`Ziccif`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L101-L103) * [`Zicclsm`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L105-L107) * [`Ziccrse`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L109-L111) * [`Zfbfmin`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L320-L325) * [`Zvfbfmin`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L697-L702) * [`Zvfbfwma`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L704-L710) The `Zicbop` extension (mandatory in RVA23U64) adds prefetch hints to prepare for subsequent memory operations (will be executed as no-op if the hardware does not support this extension). The `Zicbom` extension (mandatory in RVA23U64) adds cache block-management instructions. The author did not include this in the batch 2 (because of limited use cases compared to the `Zicboz` extension) but added because it will be discoverable from Linux (as of version 6.15-rc4). Along with `Zicbop`, Rust now supports all CMO extensions. The `Zic64b` extension (mandatory in RVA23U64) constraints the cache block to be naturally-aligned and exactly 64 bytes. Along with CMO instructions, it can improve efficiency handling with memory (e.g. efficient memory zeroing using `Zicboz` + `Zic64b`). The `Zicc*` extensions (mandatory in RVA23U64) add constraints to the main memory properties. They are normally satisfied in the application environment with regular OSes but profiles like RVA23U64 ensures such properties are satisfied (through those *constraint* extensions). The `Zfbf*` and `Zvfbf*` extensions (optional in RVA23U64) add instructions to handle BF16 (BFloat16) data. Although stabilization of FP-related extensions are relatively far due to ABI-related issues, they are included in this batch because they will be discoverable from Linux (as of version 6.15-rc4). The author also adds the extension implication: `Za64rs` → `Za128rs` (superset) which the author missed to include in #140139.
2 parents 01adc82 + 501a539 commit 19c9b76

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

compiler/rustc_target/src/target_features.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
510510
("unaligned-vector-mem", Unstable(sym::riscv_target_feature), &[]),
511511
("v", Unstable(sym::riscv_target_feature), &["zvl128b", "zve64d"]),
512512
("za128rs", Unstable(sym::riscv_target_feature), &[]),
513-
("za64rs", Unstable(sym::riscv_target_feature), &[]),
513+
("za64rs", Unstable(sym::riscv_target_feature), &["za128rs"]), // Za64rs ⊃ Za128rs
514514
("zaamo", Unstable(sym::riscv_target_feature), &[]),
515515
("zabha", Unstable(sym::riscv_target_feature), &["zaamo"]),
516516
("zacas", Unstable(sym::riscv_target_feature), &["zaamo"]),
@@ -529,12 +529,20 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
529529
("zcmop", Unstable(sym::riscv_target_feature), &["zca"]),
530530
("zdinx", Unstable(sym::riscv_target_feature), &["zfinx"]),
531531
("zfa", Unstable(sym::riscv_target_feature), &["f"]),
532+
("zfbfmin", Unstable(sym::riscv_target_feature), &["f"]), // and a subset of Zfhmin
532533
("zfh", Unstable(sym::riscv_target_feature), &["zfhmin"]),
533534
("zfhmin", Unstable(sym::riscv_target_feature), &["f"]),
534535
("zfinx", Unstable(sym::riscv_target_feature), &["zicsr"]),
535536
("zhinx", Unstable(sym::riscv_target_feature), &["zhinxmin"]),
536537
("zhinxmin", Unstable(sym::riscv_target_feature), &["zfinx"]),
538+
("zic64b", Unstable(sym::riscv_target_feature), &[]),
539+
("zicbom", Unstable(sym::riscv_target_feature), &[]),
540+
("zicbop", Unstable(sym::riscv_target_feature), &[]),
537541
("zicboz", Unstable(sym::riscv_target_feature), &[]),
542+
("ziccamoa", Unstable(sym::riscv_target_feature), &[]),
543+
("ziccif", Unstable(sym::riscv_target_feature), &[]),
544+
("zicclsm", Unstable(sym::riscv_target_feature), &[]),
545+
("ziccrse", Unstable(sym::riscv_target_feature), &[]),
538546
("zicntr", Unstable(sym::riscv_target_feature), &["zicsr"]),
539547
("zicond", Unstable(sym::riscv_target_feature), &[]),
540548
("zicsr", Unstable(sym::riscv_target_feature), &[]),
@@ -561,6 +569,8 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
561569
("zve64d", Unstable(sym::riscv_target_feature), &["zve64f", "d"]),
562570
("zve64f", Unstable(sym::riscv_target_feature), &["zve32f", "zve64x"]),
563571
("zve64x", Unstable(sym::riscv_target_feature), &["zve32x", "zvl64b"]),
572+
("zvfbfmin", Unstable(sym::riscv_target_feature), &["zve32f"]),
573+
("zvfbfwma", Unstable(sym::riscv_target_feature), &["zfbfmin", "zvfbfmin"]),
564574
("zvfh", Unstable(sym::riscv_target_feature), &["zvfhmin", "zve32f", "zfhmin"]), // Zvfh ⊃ Zvfhmin
565575
("zvfhmin", Unstable(sym::riscv_target_feature), &["zve32f"]),
566576
("zvkb", Unstable(sym::riscv_target_feature), &["zve32x"]),

tests/ui/check-cfg/target_feature.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,20 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
324324
`zcmop`
325325
`zdinx`
326326
`zfa`
327+
`zfbfmin`
327328
`zfh`
328329
`zfhmin`
329330
`zfinx`
330331
`zhinx`
331332
`zhinxmin`
333+
`zic64b`
334+
`zicbom`
335+
`zicbop`
332336
`zicboz`
337+
`ziccamoa`
338+
`ziccif`
339+
`zicclsm`
340+
`ziccrse`
333341
`zicntr`
334342
`zicond`
335343
`zicsr`
@@ -356,6 +364,8 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
356364
`zve64d`
357365
`zve64f`
358366
`zve64x`
367+
`zvfbfmin`
368+
`zvfbfwma`
359369
`zvfh`
360370
`zvfhmin`
361371
`zvkb`

0 commit comments

Comments
 (0)