Skip to content

Commit 677da1c

Browse files
authored
Rollup merge of #110884 - korran:unaligned-scalar-mem, r=wesleywiser
Support RISC-V unaligned-scalar-mem target feature This adds `unaligned-scalar-mem` as an allowed RISC-V target feature. Some RISC-V cores support unaligned access to memory without trapping. On such cores, the compiler could significantly improve code-size and performance when using functions like core::ptr::read_unaligned<u32> by emitting a single load or store instruction with an unaligned address, rather than a long sequence of byte load/store/bitmanip instructions. Enabling the `unaligned-scalar-mem` target feature allows LLVM to do this optimization. Fixes #110883
2 parents 77fb0cd + 08f7e32 commit 677da1c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const RISCV_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
250250
("f", Some(sym::riscv_target_feature)),
251251
("m", Some(sym::riscv_target_feature)),
252252
("relax", Some(sym::riscv_target_feature)),
253+
("unaligned-scalar-mem", Some(sym::riscv_target_feature)),
253254
("v", Some(sym::riscv_target_feature)),
254255
("zba", Some(sym::riscv_target_feature)),
255256
("zbb", Some(sym::riscv_target_feature)),

0 commit comments

Comments
 (0)