Skip to content

Commit b378059

Browse files
committed
update target feature following LLVM API change
LLVM commit llvm/llvm-project@e817966 renamed the `unaligned-scalar-mem` target feature to `fast-unaligned-access`.
1 parent 0a83e43 commit b378059

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+4
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> {
263263
"sve2-bitperm",
264264
TargetFeatureFoldStrength::EnableOnly("neon"),
265265
),
266+
// The unaligned-scalar-mem feature was renamed to fast-unaligned-access.
267+
("riscv32" | "riscv64", "fast-unaligned-access") if get_version().0 <= 17 => {
268+
LLVMFeature::new("unaligned-scalar-mem")
269+
}
266270
(_, s) => LLVMFeature::new(s),
267271
}
268272
}

compiler/rustc_codegen_ssa/src/target_features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ const RISCV_ALLOWED_FEATURES: &[(&str, Stability)] = &[
291291
("d", Unstable(sym::riscv_target_feature)),
292292
("e", Unstable(sym::riscv_target_feature)),
293293
("f", Unstable(sym::riscv_target_feature)),
294+
("fast-unaligned-access", Unstable(sym::riscv_target_feature)),
294295
("m", Stable),
295296
("relax", Unstable(sym::riscv_target_feature)),
296-
("unaligned-scalar-mem", Unstable(sym::riscv_target_feature)),
297297
("v", Unstable(sym::riscv_target_feature)),
298298
("zba", Stable),
299299
("zbb", Stable),

tests/ui/abi/riscv-discoverability-guidance.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// revisions: riscv32 riscv64
33
//
44
// [riscv32] needs-llvm-components: riscv
5-
// [riscv32] compile-flags: --target=riscv32i-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib
5+
// [riscv32] compile-flags: --target=riscv32i-unknown-none-elf -C target-feature=-fast-unaligned-access --crate-type=rlib
66
// [riscv64] needs-llvm-components: riscv
7-
// [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib
7+
// [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf -C target-feature=-fast-unaligned-access --crate-type=rlib
88
#![no_core]
99
#![feature(
1010
no_core,

0 commit comments

Comments
 (0)