Skip to content

Commit

Permalink
Update tests to use llvm_asm!
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Mar 26, 2020
1 parent d162d09 commit 1cc521e
Show file tree
Hide file tree
Showing 74 changed files with 421 additions and 401 deletions.
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0668.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assembly call.
In particular, it can happen if you forgot the closing bracket of a register
constraint (see issue #51430):
```compile_fail,E0668
#![feature(asm)]
#![feature(llvm_asm)]
fn main() {
let rax: u64;
Expand Down
4 changes: 2 additions & 2 deletions src/test/codegen/no-output-asm-is-volatile.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// compile-flags: -O

#![feature(asm)]
#![feature(llvm_asm)]
#![crate_type = "lib"]

// Check that inline assembly expressions without any outputs
Expand All @@ -9,6 +9,6 @@
// CHECK-LABEL: @assembly
#[no_mangle]
pub fn assembly() {
unsafe { asm!("") }
unsafe { llvm_asm!("") }
// CHECK: tail call void asm sideeffect "", {{.*}}
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/asm-src-loc-codegen-units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// compile-flags: -C codegen-units=2
// ignore-emscripten

#![feature(asm)]
#![feature(llvm_asm)]

fn main() {
unsafe {
asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
}
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/asm-src-loc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// ignore-emscripten

#![feature(asm)]
#![feature(llvm_asm)]

fn main() {
unsafe {
asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
}
}
146 changes: 73 additions & 73 deletions src/test/incremental/hashes/inline_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#![allow(warnings)]
#![feature(rustc_attrs)]
#![feature(asm)]
#![feature(llvm_asm)]
#![crate_type="rlib"]


Expand All @@ -22,12 +22,12 @@
pub fn change_template(a: i32) -> i32 {
let c: i32;
unsafe {
asm!("add 1, $0"
: "=r"(c)
: "0"(a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(c)
: "0"(a)
:
:
);
}
c
}
Expand All @@ -39,12 +39,12 @@ pub fn change_template(a: i32) -> i32 {
pub fn change_template(a: i32) -> i32 {
let c: i32;
unsafe {
asm!("add 2, $0"
: "=r"(c)
: "0"(a)
:
:
);
llvm_asm!("add 2, $0"
: "=r"(c)
: "0"(a)
:
:
);
}
c
}
Expand All @@ -58,12 +58,12 @@ pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0;
let mut _out2: i32 = 0;
unsafe {
asm!("add 1, $0"
: "=r"(_out1)
: "0"(a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out1)
: "0"(a)
:
:
);
}
_out1
}
Expand All @@ -76,12 +76,12 @@ pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0;
let mut _out2: i32 = 0;
unsafe {
asm!("add 1, $0"
: "=r"(_out2)
: "0"(a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out2)
: "0"(a)
:
:
);
}
_out1
}
Expand All @@ -94,12 +94,12 @@ pub fn change_output(a: i32) -> i32 {
pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
}
_out
}
Expand All @@ -111,12 +111,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_b)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_b)
:
:
);
}
_out
}
Expand All @@ -129,12 +129,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a), "r"(_b)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a), "r"(_b)
:
:
);
}
_out
}
Expand All @@ -146,12 +146,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "r"(_a), "0"(_b)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "r"(_a), "0"(_b)
:
:
);
}
_out
}
Expand All @@ -164,12 +164,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
pub fn change_clobber(_a: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
}
_out
}
Expand All @@ -181,12 +181,12 @@ pub fn change_clobber(_a: i32) -> i32 {
pub fn change_clobber(_a: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
: "eax"
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
: "eax"
:
);
}
_out
}
Expand All @@ -199,12 +199,12 @@ pub fn change_clobber(_a: i32) -> i32 {
pub fn change_options(_a: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
:
);
}
_out
}
Expand All @@ -216,12 +216,12 @@ pub fn change_options(_a: i32) -> i32 {
pub fn change_options(_a: i32) -> i32 {
let _out;
unsafe {
asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
: "volatile"
);
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
:
: "volatile"
);
}
_out
}
8 changes: 4 additions & 4 deletions src/test/mir-opt/unreachable_asm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-tidy-linelength
#![feature(asm)]
#![feature(llvm_asm)]

enum Empty {}

Expand All @@ -18,7 +18,7 @@ fn main() {
}

// asm instruction stops unreachable propagation to if else blocks bb4 and bb5.
unsafe { asm!("NOP"); }
unsafe { llvm_asm!("NOP"); }
match _x { }
}
}
Expand All @@ -39,7 +39,7 @@ fn main() {
// StorageDead(_6);
// StorageDead(_5);
// StorageLive(_7);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _7 = ();
// StorageDead(_7);
// StorageLive(_8);
Expand All @@ -62,7 +62,7 @@ fn main() {
// StorageDead(_6);
// StorageDead(_5);
// StorageLive(_7);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _7 = ();
// StorageDead(_7);
// StorageLive(_8);
Expand Down
14 changes: 7 additions & 7 deletions src/test/mir-opt/unreachable_asm_2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-tidy-linelength
#![feature(asm)]
#![feature(llvm_asm)]

enum Empty {}

Expand All @@ -13,11 +13,11 @@ fn main() {

if true {
// asm instruction stops unreachable propagation to block bb3.
unsafe { asm!("NOP"); }
unsafe { llvm_asm!("NOP"); }
_y = 21;
} else {
// asm instruction stops unreachable propagation to block bb3.
unsafe { asm!("NOP"); }
unsafe { llvm_asm!("NOP"); }
_y = 42;
}

Expand All @@ -33,7 +33,7 @@ fn main() {
// }
// bb4: {
// StorageLive(_8);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _8 = ();
// StorageDead(_8);
// _4 = const 42i32;
Expand All @@ -42,7 +42,7 @@ fn main() {
// }
// bb5: {
// StorageLive(_7);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _7 = ();
// StorageDead(_7);
// _4 = const 21i32;
Expand All @@ -64,7 +64,7 @@ fn main() {
// }
// bb4: {
// StorageLive(_8);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _8 = ();
// StorageDead(_8);
// _4 = const 42i32;
Expand All @@ -73,7 +73,7 @@ fn main() {
// }
// bb5: {
// StorageLive(_7);
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
// _7 = ();
// StorageDead(_7);
// _4 = const 21i32;
Expand Down
4 changes: 2 additions & 2 deletions src/test/pretty/asm-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#![feature(asm)]
#![feature(llvm_asm)]

pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }
pub fn main() { unsafe { llvm_asm!("" : : : "hello", "world") }; }
8 changes: 4 additions & 4 deletions src/test/pretty/asm-options.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![feature(asm)]
#![feature(llvm_asm)]

// pp-exact

pub fn main() {
unsafe {
asm!("" : : : : "volatile");
asm!("" : : : : "alignstack");
asm!("" : : : : "intel");
llvm_asm!("" : : : : "volatile");
llvm_asm!("" : : : : "alignstack");
llvm_asm!("" : : : : "intel");
}
}
Loading

0 comments on commit 1cc521e

Please sign in to comment.