Skip to content

Commit 5ebdec5

Browse files
committed
rustc_codegen_llvm: Adjust RISC-V inline assembly's clobber list
Despite that the `fflags` register (representing floating point exception flags) is stated as a flag register in the reference, it's not in the default clobber list of the RISC-V inline assembly and it would be better to fix it.
1 parent 52618eb commit 5ebdec5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
240240
}
241241
InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => {
242242
constraints.extend_from_slice(&[
243+
"~{fflags}".to_string(),
243244
"~{vtype}".to_string(),
244245
"~{vl}".to_string(),
245246
"~{vxsat}".to_string(),

tests/codegen-llvm/asm/riscv-clobbers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern crate minicore;
1717
use minicore::*;
1818

1919
// CHECK-LABEL: @flags_clobber
20-
// CHECK: call void asm sideeffect "", "~{vtype},~{vl},~{vxsat},~{vxrm}"()
20+
// CHECK: call void asm sideeffect "", "~{fflags},~{vtype},~{vl},~{vxsat},~{vxrm}"()
2121
#[no_mangle]
2222
pub unsafe fn flags_clobber() {
2323
asm!("", options(nostack, nomem));

0 commit comments

Comments
 (0)