Mark condition/carry bit as clobbered in C-SKY inline assembly
This commit is contained in:
parent
fdd1a3b026
commit
93465e6c31
3 changed files with 29 additions and 1 deletions
|
@ -286,7 +286,9 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
InlineAsmArch::M68k => {
|
||||
constraints.push("~{ccr}".to_string());
|
||||
}
|
||||
InlineAsmArch::CSKY => {}
|
||||
InlineAsmArch::CSKY => {
|
||||
constraints.push("~{psr}".to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
if !options.contains(InlineAsmOptions::NOMEM) {
|
||||
|
|
|
@ -199,3 +199,5 @@ These flags registers must be restored upon exiting the asm block if the `preser
|
|||
- SPARC
|
||||
- Integer condition codes (`icc` and `xcc`)
|
||||
- Floating-point condition codes (`fcc[0-3]`)
|
||||
- CSKY
|
||||
- Condition/carry bit (C) in `PSR`.
|
||||
|
|
24
tests/codegen/asm/csky-clobbers.rs
Normal file
24
tests/codegen/asm/csky-clobbers.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
//@ add-core-stubs
|
||||
//@ compile-flags: --target csky-unknown-linux-gnuabiv2
|
||||
//@ needs-llvm-components: csky
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
#![feature(no_core, asm_experimental_arch)]
|
||||
#![no_core]
|
||||
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
// CHECK-LABEL: @flags_clobber
|
||||
// CHECK: call void asm sideeffect "", "~{psr}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn flags_clobber() {
|
||||
asm!("", options(nostack, nomem));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @no_clobber
|
||||
// CHECK: call void asm sideeffect "", ""()
|
||||
#[no_mangle]
|
||||
pub unsafe fn no_clobber() {
|
||||
asm!("", options(nostack, nomem, preserves_flags));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue