Auto merge of #68404 - Amanieu:llvm-asm, r=estebank
Rename asm! to llvm_asm! As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850. This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
This commit is contained in:
commit
6c19a10e24
136 changed files with 634 additions and 588 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// build-pass
|
||||
#![allow(unused_macros)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
type History = Vec<&'static str>;
|
||||
|
||||
|
|
@ -18,10 +18,10 @@ macro_rules! demo {
|
|||
|
||||
let mut history: History = vec![];
|
||||
unsafe {
|
||||
asm!("mov ($1), $0"
|
||||
: $output_constraint (*wrap(&mut x, "out", &mut history))
|
||||
: "r"(&wrap(y, "in", &mut history))
|
||||
:: "volatile");
|
||||
llvm_asm!("mov ($1), $0"
|
||||
: $output_constraint (*wrap(&mut x, "out", &mut history))
|
||||
: "r"(&wrap(y, "in", &mut history))
|
||||
:: "volatile");
|
||||
}
|
||||
assert_eq!((x,y), (1,1));
|
||||
let b: &[_] = &["out", "in"];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
// build-fail
|
||||
// only-x86_64
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
asm!("int $3"); //~ ERROR too few operands for instruction
|
||||
//~| ERROR invalid operand in inline asm
|
||||
llvm_asm!("int $3"); //~ ERROR too few operands for instruction
|
||||
//~| ERROR invalid operand in inline asm
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: invalid operand in inline asm: 'int $3'
|
||||
--> $DIR/issue-23458.rs:8:9
|
||||
|
|
||||
LL | asm!("int $3");
|
||||
| ^^^^^^^^^^^^^^^
|
||||
LL | llvm_asm!("int $3");
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: <inline asm>:1:2: error: too few operands for instruction
|
||||
int
|
||||
|
|
@ -10,8 +10,8 @@ error: <inline asm>:1:2: error: too few operands for instruction
|
|||
|
||||
--> $DIR/issue-23458.rs:8:9
|
||||
|
|
||||
LL | asm!("int $3");
|
||||
| ^^^^^^^^^^^^^^^
|
||||
LL | llvm_asm!("int $3");
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// only-x86_64
|
||||
|
||||
#![allow(dead_code, non_upper_case_globals)]
|
||||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
#[repr(C)]
|
||||
pub struct D32x4(f32,f32,f32,f32);
|
||||
|
|
@ -11,16 +11,16 @@ impl D32x4 {
|
|||
fn add(&self, vec: Self) -> Self {
|
||||
unsafe {
|
||||
let ret: Self;
|
||||
asm!("
|
||||
movaps $1, %xmm1
|
||||
movaps $2, %xmm2
|
||||
addps %xmm1, %xmm2
|
||||
movaps $xmm1, $0
|
||||
"
|
||||
: "=r"(ret)
|
||||
: "1"(self), "2"(vec)
|
||||
: "xmm1", "xmm2"
|
||||
);
|
||||
llvm_asm!("
|
||||
movaps $1, %xmm1
|
||||
movaps $2, %xmm2
|
||||
addps %xmm1, %xmm2
|
||||
movaps $xmm1, $0
|
||||
"
|
||||
: "=r"(ret)
|
||||
: "1"(self), "2"(vec)
|
||||
: "xmm1", "xmm2"
|
||||
);
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// check-pass
|
||||
// ignore-emscripten
|
||||
|
||||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
macro_rules! interrupt_handler {
|
||||
() => {
|
||||
unsafe fn _interrupt_handler() {
|
||||
asm!("pop eax" :::: "intel");
|
||||
llvm_asm!("pop eax" :::: "intel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
// build-fail
|
||||
// ignore-emscripten no asm! support
|
||||
// ignore-emscripten no llvm_asm! support
|
||||
|
||||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
asm!("" :: "r"(""));
|
||||
llvm_asm!("" :: "r"(""));
|
||||
//~^ ERROR: invalid value for constraint in inline assembly
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0669]: invalid value for constraint in inline assembly
|
||||
--> $DIR/issue-37433.rs:8:24
|
||||
--> $DIR/issue-37433.rs:8:29
|
||||
|
|
||||
LL | asm!("" :: "r"(""));
|
||||
| ^^
|
||||
LL | llvm_asm!("" :: "r"(""));
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
// build-fail
|
||||
// ignore-emscripten
|
||||
|
||||
#![feature(asm)]
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
macro_rules! fake_jump {
|
||||
($id:expr) => {
|
||||
unsafe {
|
||||
asm!(
|
||||
llvm_asm!(
|
||||
"
|
||||
jmp $0
|
||||
lea eax, [ebx]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ impl bomb for S { fn boom(&self, _: Ident) { } }
|
|||
|
||||
pub struct Ident { name: usize }
|
||||
|
||||
// macro_rules! int3 { () => ( unsafe { asm!( "int3" ); } ) }
|
||||
// macro_rules! int3 { () => ( unsafe { llvm_asm!( "int3" ); } ) }
|
||||
macro_rules! int3 { () => ( { } ) }
|
||||
|
||||
fn Ident_new() -> Ident {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue