rust/compiler
Matthias Krüger ff55f2af75
Rollup merge of #139440 - a4lg:riscv-feature-addition-batch-2, r=Amanieu
rustc_target: RISC-V: feature addition batch 2

Of ratified RISC-V extensions, this commit adds ones satisfying following criteria:

1.  Either discoverable through a `riscv_hwprobe` system call on Linux 6.14
    or should be very helpful even on basic needs (the `B` extension),
2.  Does not disrupt current Rust's feature handling mechanism and
3.  Not too OS-dependent (the `Supm` extension)

Due to 2., the author excluded `Zcf` (RV32 only) and `Zcd` from the list despite that they are discoverable from Linux 6.14.

Due to 3., the author excluded the `Supm` extension on the PR version 2.

This is based on the specification:
*   [The latest ratified ISA Manuals (version 20240411)](16154769/RISC-V+Technical+Specifications)

Linux Definition: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/include/uapi/asm/hwprobe.h

LLVM Definitions:

*   [`B`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L507-L510)
*   [`Zca`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L395-L398)
*   [`Zcb`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L407-L410)
*   [`Zcmop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L460-L463)
*   [`Zfa`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L335-L338)
*   [`Zicboz`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L89-L92)
*   [`Zicond`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L125-L128)
*   [`Zihintntl`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L148-L151)
*   [`Zimop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L161-L162)
*   [`Ztso`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L214-L217)

The author also adds required implication: `C` implies `Zca`.

Android RISC-V target is also updated to include the `B` extension (this is just a shorthand combination of `Zba`, `Zbb` and `Zbs` extensions but possibly simplifies `target_feature` handling).

# History

## Version 1 → 2

*   Remove the `Supm` extension from the Rust target features (thanks, `@Amanieu).`

--------

Related:
*   #44839
    (`riscv_target_feature`)
*   #138823
    (my previous batch)
*   #132618
    (stabilization of the `Zfa` extension is blocked by this)

`@rustbot` r? `@Amanieu`
`@rustbot` label +T-compiler +O-riscv +A-target-feature
2025-04-17 00:16:21 +02:00
..
rustc Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_abi Initial UnsafePinned/UnsafeUnpin impl [Part 1: Libs] 2025-04-13 01:11:04 -04:00
rustc_arena Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_ast Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk 2025-04-14 18:15:31 +02:00
rustc_ast_ir Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_ast_lowering Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors 2025-04-15 21:16:05 +02:00
rustc_ast_passes Add hard error for extern without explicit ABI 2025-04-16 22:43:56 +03:00
rustc_ast_pretty Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
rustc_attr_data_structures add rustc_macro_edition_2021 2025-03-19 17:37:35 +01:00
rustc_attr_parsing Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Fix wrong suggestion for async gen block and add regression ui test for #139839 2025-04-15 21:48:36 +02:00
rustc_builtin_macros Auto merge of #139781 - jhpratt:rollup-qadsjvb, r=jhpratt 2025-04-14 07:07:54 +00:00
rustc_codegen_cranelift Move has_self field to hir::AssocKind::Fn. 2025-04-14 16:13:04 +10:00
rustc_codegen_gcc Prepend temp files with a string per invocation of rustc 2025-04-07 20:48:40 +00:00
rustc_codegen_llvm Revert "Deduplicate template parameter creation" 2025-04-15 21:00:11 +03:00
rustc_codegen_ssa Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
rustc_const_eval Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
rustc_data_structures Switch to diagnostic::on_unimplemented 2025-04-14 01:38:18 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
rustc_error_codes error on unsafe attributes in pre-2024 editions 2025-04-13 01:22:59 +02:00
rustc_error_messages update cfgs 2025-04-09 12:29:59 +01:00
rustc_errors Rollup merge of #139468 - compiler-errors:has_stashed_diagnostic, r=oli-obk 2025-04-09 14:52:38 +02:00
rustc_expand Rollup merge of #139671 - m-ou-se:proc-macro-span, r=dtolnay 2025-04-15 15:47:27 +10:00
rustc_feature Add explicit_extern_abis unstable feature 2025-04-15 14:33:19 +03:00
rustc_fluent_macro Replace proc_macro::SourceFile by Span::{file, local_file}. 2025-04-11 15:07:08 +02:00
rustc_fs_util Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar 2025-04-15 08:02:23 +00:00
rustc_hir_analysis Don't compute name of associated item if it's an RPITIT 2025-04-15 18:46:26 +00:00
rustc_hir_pretty Fix HIR pretty-printing of fns with just a variadic arg. 2025-04-15 10:41:10 +10:00
rustc_hir_typeck Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors 2025-04-15 21:16:05 +02:00
rustc_incremental Remove safe remove 2025-04-14 18:47:15 +00:00
rustc_index Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_index_macros In rustc_mir_tranform, iterate over index newtypes instead of ints 2025-04-12 11:53:07 +00:00
rustc_infer Auto merge of #139768 - compiler-errors:split-fold, r=lcnr 2025-04-16 01:46:01 +00:00
rustc_interface Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
rustc_lexer Replace rustc_lexer/unescape with rustc-literal-escaper crate 2025-04-04 14:44:45 +02:00
rustc_lint Rollup merge of #135340 - obeis:explicit-extern-abis, r=traviscross,nadrieril 2025-04-17 00:16:20 +02:00
rustc_lint_defs Rollup merge of #139001 - folkertdev:naked-function-rustic-abi, r=traviscross,compiler-errors 2025-04-13 17:37:52 -04:00
rustc_llvm Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
rustc_log Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00
rustc_metadata Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obk 2025-04-15 15:47:27 +10:00
rustc_middle Auto merge of #139768 - compiler-errors:split-fold, r=lcnr 2025-04-16 01:46:01 +00:00
rustc_mir_build Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar 2025-04-15 08:02:23 +00:00
rustc_mir_dataflow Remove support for #[rustc_mir(borrowck_graphviz_format="gen_kill")]. 2025-04-16 08:35:34 +10:00
rustc_mir_transform Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar 2025-04-15 08:02:23 +00:00
rustc_monomorphize Rollup merge of #139818 - compiler-errors:normalize-tails, r=oli-obk 2025-04-15 21:16:03 +02:00
rustc_next_trait_solver Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar 2025-04-15 08:02:23 +00:00
rustc_parse Rollup merge of #139797 - folkertdev:naked-allow-unsafe, r=tgross35 2025-04-14 21:55:39 +02:00
rustc_parse_format Update rustc-literal-escaper version to 0.0.2 2025-04-04 22:26:10 +02:00
rustc_passes Use newtype_index!-generated types more idiomatically 2025-04-14 16:17:06 +00:00
rustc_pattern_analysis Fix stack overflow in exhaustiveness due to recursive HIR opaque type values 2025-04-07 22:41:48 +00:00
rustc_privacy Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_query_impl Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
rustc_query_system Rollup merge of #139636 - Zoxc:graph-edges-len-u32, r=compiler-errors 2025-04-13 23:57:37 -04:00
rustc_resolve Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors 2025-04-15 21:16:05 +02:00
rustc_sanitizers Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obk 2025-04-15 15:47:27 +10:00
rustc_serialize Bump FileEncoder buffer size to 64 kB 2025-04-10 18:52:03 +02:00
rustc_session Rollup merge of #139876 - blyxyas:write_type_sizes, r=nnethercote 2025-04-16 13:45:30 +02:00
rustc_smir Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obk 2025-04-15 15:47:27 +10:00
rustc_span Rollup merge of #135340 - obeis:explicit-extern-abis, r=traviscross,nadrieril 2025-04-17 00:16:20 +02:00
rustc_symbol_mangling Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors 2025-04-15 21:16:05 +02:00
rustc_target rustc_target: Use "B" shorthand on the RISC-V Android target 2025-04-16 01:20:54 +00:00
rustc_trait_selection Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar 2025-04-15 08:02:23 +00:00
rustc_traits re-use sized fast path 2025-04-09 10:42:26 +00:00
rustc_transmute Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_ty_utils Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obk 2025-04-15 15:47:27 +10:00
rustc_type_ir Auto merge of #139768 - compiler-errors:split-fold, r=lcnr 2025-04-16 01:46:01 +00:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00
stable_mir let rustc_smir host stable_mir for refactoring 2025-04-05 18:23:07 +08:00