Auto merge of #143227 - tshepang:asm-label-operand, r=Amanieu
add multi-arch asm! label operand test Added this since the other label operand tests are only for x86
This commit is contained in:
commit
bd3487101f
3 changed files with 58 additions and 5 deletions
|
|
@ -644,11 +644,9 @@ impl TestProps {
|
|||
|
||||
self.update_add_core_stubs(ln, config);
|
||||
|
||||
if let Some(flags) = config.parse_name_value_directive(
|
||||
ln,
|
||||
directives::CORE_STUBS_COMPILE_FLAGS,
|
||||
testfile,
|
||||
) {
|
||||
if let Some(flags) =
|
||||
config.parse_name_value_directive(ln, CORE_STUBS_COMPILE_FLAGS, testfile)
|
||||
{
|
||||
let flags = split_flags(&flags);
|
||||
for flag in &flags {
|
||||
if flag == "--edition" || flag.starts_with("--edition=") {
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"only-aarch64-unknown-linux-gnu",
|
||||
"only-apple",
|
||||
"only-arm",
|
||||
"only-arm64ec",
|
||||
"only-avr",
|
||||
"only-beta",
|
||||
"only-bpf",
|
||||
|
|
@ -217,6 +218,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"only-nightly",
|
||||
"only-nvptx64",
|
||||
"only-powerpc",
|
||||
"only-riscv32",
|
||||
"only-riscv64",
|
||||
"only-rustc_abi-x86-sse2",
|
||||
"only-s390x",
|
||||
|
|
|
|||
53
tests/ui/asm/label-operand.rs
Normal file
53
tests/ui/asm/label-operand.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//@ run-pass
|
||||
//@ reference: asm.operand-type.supported-operands.label
|
||||
//@ revisions: aarch64 arm arm64ec riscv32 riscv64 x86 x86_64
|
||||
//@ needs-asm-support
|
||||
//@[aarch64] only-aarch64
|
||||
//@[arm64ec] only-arm64ec
|
||||
//@[arm] only-arm
|
||||
//@[riscv32] only-riscv32
|
||||
//@[riscv64] only-riscv64
|
||||
//@[x86] only-x86
|
||||
//@[x86_64] only-x86_64
|
||||
|
||||
#[cfg(any(aarch64, arm, arm64ec))]
|
||||
fn make_true(value: &mut bool) {
|
||||
unsafe {
|
||||
core::arch::asm!(
|
||||
"b {}",
|
||||
label {
|
||||
*value = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(riscv32, riscv64))]
|
||||
fn make_true(value: &mut bool) {
|
||||
unsafe {
|
||||
core::arch::asm!(
|
||||
"j {}",
|
||||
label {
|
||||
*value = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(x86, x86_64))]
|
||||
fn make_true(value: &mut bool) {
|
||||
unsafe {
|
||||
core::arch::asm!(
|
||||
"jmp {}",
|
||||
label {
|
||||
*value = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut value = false;
|
||||
make_true(&mut value);
|
||||
assert!(value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue