2020-02-20 03:19:48 -06:00
|
|
|
//@ only-x86_64
|
|
|
|
|
2023-12-27 16:57:17 -06:00
|
|
|
#![feature(asm_unwind, asm_goto)]
|
|
|
|
|
2021-12-09 18:15:33 -06:00
|
|
|
use std::arch::{asm, global_asm};
|
2020-02-20 03:19:48 -06: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 04:15:50 -05:00
|
|
|
//~^^ ERROR asm with the `pure` option must have at least one output
|
2020-02-20 03:19:48 -06:00
|
|
|
asm!("{}", in(reg) foo, options(pure, nomem));
|
2021-07-29 04:15:50 -05:00
|
|
|
//~^ ERROR asm with the `pure` option must have at least one output
|
2020-02-20 03:19:48 -06:00
|
|
|
asm!("{}", out(reg) foo, options(noreturn));
|
|
|
|
//~^ ERROR asm outputs are not allowed with the `noreturn` option
|
2023-12-27 16:57:17 -06:00
|
|
|
asm!("{}", label {}, options(may_unwind));
|
|
|
|
//~^ ERROR asm labels are not allowed with the `may_unwind` option
|
2020-02-20 03:19:48 -06:00
|
|
|
}
|
2021-07-29 06:43:26 -05: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-10-14 02:23:09 -05:00
|
|
|
asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C"));
|
|
|
|
//~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs
|
|
|
|
//~| ERROR `C` ABI specified multiple times
|
2021-07-29 06:43:26 -05:00
|
|
|
asm!("", out("eax") foo, clobber_abi("C"));
|
|
|
|
}
|
2020-02-20 03:19:48 -06:00
|
|
|
}
|
2021-04-13 12:11:11 -05:00
|
|
|
|
|
|
|
global_asm!("", options(nomem));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `nomem` option cannot be used with `global_asm!`
|
2021-04-13 12:11:11 -05:00
|
|
|
global_asm!("", options(readonly));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `readonly` option cannot be used with `global_asm!`
|
2021-04-13 12:11:11 -05:00
|
|
|
global_asm!("", options(noreturn));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `noreturn` option cannot be used with `global_asm!`
|
2021-04-13 12:11:11 -05:00
|
|
|
global_asm!("", options(pure));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `pure` option cannot be used with `global_asm!`
|
2021-04-13 12:11:11 -05:00
|
|
|
global_asm!("", options(nostack));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `nostack` option cannot be used with `global_asm!`
|
2021-04-13 12:11:11 -05:00
|
|
|
global_asm!("", options(preserves_flags));
|
2024-07-25 03:05:31 -05:00
|
|
|
//~^ ERROR the `preserves_flags` option cannot be used with `global_asm!`
|