Rename asm! to llvm_asm!

asm! is left as a wrapper around llvm_asm! to maintain compatibility.
This commit is contained in:
Amanieu d'Antras 2020-01-14 13:40:42 +00:00
parent 2fbb07525e
commit d162d096dd
65 changed files with 213 additions and 187 deletions

View file

@ -113,7 +113,7 @@ pub fn black_box<T>(dummy: T) -> T {
// box. This isn't the greatest implementation since it probably deoptimizes
// more than we want, but it's so far good enough.
unsafe {
asm!("" : : "r"(&dummy));
llvm_asm!("" : : "r"(&dummy));
dummy
}
}

View file

@ -98,6 +98,7 @@
#![feature(is_sorted)]
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(llvm_asm)]
#![cfg_attr(not(bootstrap), feature(negative_impls))]
#![feature(never_type)]
#![feature(nll)]

View file

@ -1307,7 +1307,7 @@ pub(crate) mod builtin {
/// [unstable book]: ../unstable-book/library-features/asm.html
#[unstable(
feature = "asm",
issue = "29722",
issue = "70173",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
@ -1322,6 +1322,47 @@ pub(crate) mod builtin {
};
}
/// Inline assembly.
///
/// Read the [unstable book] for the usage.
///
/// [unstable book]: ../unstable-book/library-features/asm.html
#[cfg(bootstrap)]
#[unstable(
feature = "llvm_asm",
issue = "70173",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[macro_export]
#[allow_internal_unstable(asm)]
macro_rules! llvm_asm {
// Redirect to asm! for stage0
($($arg:tt)*) => { $crate::asm!($($arg)*) }
}
/// Inline assembly.
///
/// Read the [unstable book] for the usage.
///
/// [unstable book]: ../unstable-book/library-features/asm.html
#[cfg(not(bootstrap))]
#[unstable(
feature = "llvm_asm",
issue = "70173",
reason = "inline assembly is not stable enough for use and is subject to change"
)]
#[rustc_builtin_macro]
#[macro_export]
macro_rules! llvm_asm {
("assembly template"
: $("output"(operand),)*
: $("input"(operand),)*
: $("clobbers",)*
: $("options",)*) => {
/* compiler built-in */
};
}
/// Module-level inline assembly.
#[unstable(
feature = "global_asm",

View file

@ -60,7 +60,7 @@ mod fpu_precision {
fn set_cw(cw: u16) {
// SAFETY: the `fldcw` instruction has been audited to be able to work correctly with
// any `u16`
unsafe { asm!("fldcw $0" :: "m" (cw) :: "volatile") }
unsafe { llvm_asm!("fldcw $0" :: "m" (cw) :: "volatile") }
}
/// Sets the precision field of the FPU to `T` and returns a `FPUControlWord`.
@ -78,7 +78,7 @@ mod fpu_precision {
// `FPUControlWord` structure is dropped
// SAFETY: the `fnstcw` instruction has been audited to be able to work correctly with
// any `u16`
unsafe { asm!("fnstcw $0" : "=*m" (&cw) ::: "volatile") }
unsafe { llvm_asm!("fnstcw $0" : "=*m" (&cw) ::: "volatile") }
// Set the control word to the desired precision. This is achieved by masking away the old
// precision (bits 8 and 9, 0x300) and replacing it with the precision flag computed above.

View file

@ -57,8 +57,8 @@ pub use crate::hash::macros::Hash;
#[doc(no_inline)]
pub use crate::{
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, global_asm, include, include_bytes, include_str, line, log_syntax, module_path,
option_env, stringify, trace_macros,
format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax,
module_path, option_env, stringify, trace_macros,
};
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]