2021-06-24 14:01:49 +00:00
|
|
|
// only-aarch64
|
2020-02-20 09:19:48 +00:00
|
|
|
|
2021-12-10 00:15:33 +00:00
|
|
|
use std::arch::{asm, global_asm};
|
2020-02-20 09:19:48 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut foo = 0;
|
|
|
|
unsafe {
|
|
|
|
asm!("", options(nomem, readonly));
|
|
|
|
//~^ ERROR the `nomem` and `readonly` options are mutually exclusive
|
|
|
|
asm!("", options(pure, nomem, noreturn));
|
|
|
|
//~^ ERROR the `pure` and `noreturn` options are mutually exclusive
|
2021-07-29 09:15:50 +00:00
|
|
|
//~^^ ERROR asm with the `pure` option must have at least one output
|
2020-02-20 09:19:48 +00:00
|
|
|
asm!("{}", in(reg) foo, options(pure, nomem));
|
2021-07-29 09:15:50 +00:00
|
|
|
//~^ ERROR asm with the `pure` option must have at least one output
|
2020-02-20 09:19:48 +00:00
|
|
|
asm!("{}", out(reg) foo, options(noreturn));
|
|
|
|
//~^ ERROR asm outputs are not allowed with the `noreturn` option
|
|
|
|
}
|
2021-07-29 11:43:26 +00:00
|
|
|
|
|
|
|
unsafe {
|
|
|
|
asm!("", clobber_abi("foo"));
|
|
|
|
//~^ ERROR invalid ABI for `clobber_abi`
|
|
|
|
asm!("{}", out(reg) foo, clobber_abi("C"));
|
|
|
|
//~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs
|
2021-06-24 14:01:49 +00:00
|
|
|
asm!("", out("x0") foo, clobber_abi("C"));
|
2021-07-29 11:43:26 +00:00
|
|
|
}
|
2020-02-20 09:19:48 +00:00
|
|
|
}
|
2021-04-13 17:11:11 +00:00
|
|
|
|
|
|
|
global_asm!("", options(nomem));
|
|
|
|
//~^ ERROR expected one of
|
|
|
|
global_asm!("", options(readonly));
|
|
|
|
//~^ ERROR expected one of
|
|
|
|
global_asm!("", options(noreturn));
|
|
|
|
//~^ ERROR expected one of
|
|
|
|
global_asm!("", options(pure));
|
|
|
|
//~^ ERROR expected one of
|
|
|
|
global_asm!("", options(nostack));
|
|
|
|
//~^ ERROR expected one of
|
|
|
|
global_asm!("", options(preserves_flags));
|
|
|
|
//~^ ERROR expected one of
|