Skip to content

Commit 1cc521e

Browse files
committed
Update tests to use llvm_asm!
1 parent d162d09 commit 1cc521e

File tree

74 files changed

+421
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+421
-401
lines changed

src/librustc_error_codes/error_codes/E0668.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assembly call.
77
In particular, it can happen if you forgot the closing bracket of a register
88
constraint (see issue #51430):
99
```compile_fail,E0668
10-
#![feature(asm)]
10+
#![feature(llvm_asm)]
1111
1212
fn main() {
1313
let rax: u64;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// compile-flags: -O
22

3-
#![feature(asm)]
3+
#![feature(llvm_asm)]
44
#![crate_type = "lib"]
55

66
// Check that inline assembly expressions without any outputs
@@ -9,6 +9,6 @@
99
// CHECK-LABEL: @assembly
1010
#[no_mangle]
1111
pub fn assembly() {
12-
unsafe { asm!("") }
12+
unsafe { llvm_asm!("") }
1313
// CHECK: tail call void asm sideeffect "", {{.*}}
1414
}

src/test/compile-fail/asm-src-loc-codegen-units.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// compile-flags: -C codegen-units=2
44
// ignore-emscripten
55

6-
#![feature(asm)]
6+
#![feature(llvm_asm)]
77

88
fn main() {
99
unsafe {
10-
asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
10+
llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
1111
}
1212
}

src/test/compile-fail/asm-src-loc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// ignore-emscripten
22

3-
#![feature(asm)]
3+
#![feature(llvm_asm)]
44

55
fn main() {
66
unsafe {
7-
asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
7+
llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
88
}
99
}

src/test/incremental/hashes/inline_asm.rs

+73-73
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#![allow(warnings)]
1313
#![feature(rustc_attrs)]
14-
#![feature(asm)]
14+
#![feature(llvm_asm)]
1515
#![crate_type="rlib"]
1616

1717

@@ -22,12 +22,12 @@
2222
pub fn change_template(a: i32) -> i32 {
2323
let c: i32;
2424
unsafe {
25-
asm!("add 1, $0"
26-
: "=r"(c)
27-
: "0"(a)
28-
:
29-
:
30-
);
25+
llvm_asm!("add 1, $0"
26+
: "=r"(c)
27+
: "0"(a)
28+
:
29+
:
30+
);
3131
}
3232
c
3333
}
@@ -39,12 +39,12 @@ pub fn change_template(a: i32) -> i32 {
3939
pub fn change_template(a: i32) -> i32 {
4040
let c: i32;
4141
unsafe {
42-
asm!("add 2, $0"
43-
: "=r"(c)
44-
: "0"(a)
45-
:
46-
:
47-
);
42+
llvm_asm!("add 2, $0"
43+
: "=r"(c)
44+
: "0"(a)
45+
:
46+
:
47+
);
4848
}
4949
c
5050
}
@@ -58,12 +58,12 @@ pub fn change_output(a: i32) -> i32 {
5858
let mut _out1: i32 = 0;
5959
let mut _out2: i32 = 0;
6060
unsafe {
61-
asm!("add 1, $0"
62-
: "=r"(_out1)
63-
: "0"(a)
64-
:
65-
:
66-
);
61+
llvm_asm!("add 1, $0"
62+
: "=r"(_out1)
63+
: "0"(a)
64+
:
65+
:
66+
);
6767
}
6868
_out1
6969
}
@@ -76,12 +76,12 @@ pub fn change_output(a: i32) -> i32 {
7676
let mut _out1: i32 = 0;
7777
let mut _out2: i32 = 0;
7878
unsafe {
79-
asm!("add 1, $0"
80-
: "=r"(_out2)
81-
: "0"(a)
82-
:
83-
:
84-
);
79+
llvm_asm!("add 1, $0"
80+
: "=r"(_out2)
81+
: "0"(a)
82+
:
83+
:
84+
);
8585
}
8686
_out1
8787
}
@@ -94,12 +94,12 @@ pub fn change_output(a: i32) -> i32 {
9494
pub fn change_input(_a: i32, _b: i32) -> i32 {
9595
let _out;
9696
unsafe {
97-
asm!("add 1, $0"
98-
: "=r"(_out)
99-
: "0"(_a)
100-
:
101-
:
102-
);
97+
llvm_asm!("add 1, $0"
98+
: "=r"(_out)
99+
: "0"(_a)
100+
:
101+
:
102+
);
103103
}
104104
_out
105105
}
@@ -111,12 +111,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
111111
pub fn change_input(_a: i32, _b: i32) -> i32 {
112112
let _out;
113113
unsafe {
114-
asm!("add 1, $0"
115-
: "=r"(_out)
116-
: "0"(_b)
117-
:
118-
:
119-
);
114+
llvm_asm!("add 1, $0"
115+
: "=r"(_out)
116+
: "0"(_b)
117+
:
118+
:
119+
);
120120
}
121121
_out
122122
}
@@ -129,12 +129,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
129129
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
130130
let _out;
131131
unsafe {
132-
asm!("add 1, $0"
133-
: "=r"(_out)
134-
: "0"(_a), "r"(_b)
135-
:
136-
:
137-
);
132+
llvm_asm!("add 1, $0"
133+
: "=r"(_out)
134+
: "0"(_a), "r"(_b)
135+
:
136+
:
137+
);
138138
}
139139
_out
140140
}
@@ -146,12 +146,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
146146
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
147147
let _out;
148148
unsafe {
149-
asm!("add 1, $0"
150-
: "=r"(_out)
151-
: "r"(_a), "0"(_b)
152-
:
153-
:
154-
);
149+
llvm_asm!("add 1, $0"
150+
: "=r"(_out)
151+
: "r"(_a), "0"(_b)
152+
:
153+
:
154+
);
155155
}
156156
_out
157157
}
@@ -164,12 +164,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
164164
pub fn change_clobber(_a: i32) -> i32 {
165165
let _out;
166166
unsafe {
167-
asm!("add 1, $0"
168-
: "=r"(_out)
169-
: "0"(_a)
170-
:
171-
:
172-
);
167+
llvm_asm!("add 1, $0"
168+
: "=r"(_out)
169+
: "0"(_a)
170+
:
171+
:
172+
);
173173
}
174174
_out
175175
}
@@ -181,12 +181,12 @@ pub fn change_clobber(_a: i32) -> i32 {
181181
pub fn change_clobber(_a: i32) -> i32 {
182182
let _out;
183183
unsafe {
184-
asm!("add 1, $0"
185-
: "=r"(_out)
186-
: "0"(_a)
187-
: "eax"
188-
:
189-
);
184+
llvm_asm!("add 1, $0"
185+
: "=r"(_out)
186+
: "0"(_a)
187+
: "eax"
188+
:
189+
);
190190
}
191191
_out
192192
}
@@ -199,12 +199,12 @@ pub fn change_clobber(_a: i32) -> i32 {
199199
pub fn change_options(_a: i32) -> i32 {
200200
let _out;
201201
unsafe {
202-
asm!("add 1, $0"
203-
: "=r"(_out)
204-
: "0"(_a)
205-
:
206-
:
207-
);
202+
llvm_asm!("add 1, $0"
203+
: "=r"(_out)
204+
: "0"(_a)
205+
:
206+
:
207+
);
208208
}
209209
_out
210210
}
@@ -216,12 +216,12 @@ pub fn change_options(_a: i32) -> i32 {
216216
pub fn change_options(_a: i32) -> i32 {
217217
let _out;
218218
unsafe {
219-
asm!("add 1, $0"
220-
: "=r"(_out)
221-
: "0"(_a)
222-
:
223-
: "volatile"
224-
);
219+
llvm_asm!("add 1, $0"
220+
: "=r"(_out)
221+
: "0"(_a)
222+
:
223+
: "volatile"
224+
);
225225
}
226226
_out
227227
}

src/test/mir-opt/unreachable_asm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ignore-tidy-linelength
2-
#![feature(asm)]
2+
#![feature(llvm_asm)]
33

44
enum Empty {}
55

@@ -18,7 +18,7 @@ fn main() {
1818
}
1919

2020
// asm instruction stops unreachable propagation to if else blocks bb4 and bb5.
21-
unsafe { asm!("NOP"); }
21+
unsafe { llvm_asm!("NOP"); }
2222
match _x { }
2323
}
2424
}
@@ -39,7 +39,7 @@ fn main() {
3939
// StorageDead(_6);
4040
// StorageDead(_5);
4141
// StorageLive(_7);
42-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
42+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
4343
// _7 = ();
4444
// StorageDead(_7);
4545
// StorageLive(_8);
@@ -62,7 +62,7 @@ fn main() {
6262
// StorageDead(_6);
6363
// StorageDead(_5);
6464
// StorageLive(_7);
65-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
65+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
6666
// _7 = ();
6767
// StorageDead(_7);
6868
// StorageLive(_8);

src/test/mir-opt/unreachable_asm_2.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ignore-tidy-linelength
2-
#![feature(asm)]
2+
#![feature(llvm_asm)]
33

44
enum Empty {}
55

@@ -13,11 +13,11 @@ fn main() {
1313

1414
if true {
1515
// asm instruction stops unreachable propagation to block bb3.
16-
unsafe { asm!("NOP"); }
16+
unsafe { llvm_asm!("NOP"); }
1717
_y = 21;
1818
} else {
1919
// asm instruction stops unreachable propagation to block bb3.
20-
unsafe { asm!("NOP"); }
20+
unsafe { llvm_asm!("NOP"); }
2121
_y = 42;
2222
}
2323

@@ -33,7 +33,7 @@ fn main() {
3333
// }
3434
// bb4: {
3535
// StorageLive(_8);
36-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
36+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
3737
// _8 = ();
3838
// StorageDead(_8);
3939
// _4 = const 42i32;
@@ -42,7 +42,7 @@ fn main() {
4242
// }
4343
// bb5: {
4444
// StorageLive(_7);
45-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
45+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
4646
// _7 = ();
4747
// StorageDead(_7);
4848
// _4 = const 21i32;
@@ -64,7 +64,7 @@ fn main() {
6464
// }
6565
// bb4: {
6666
// StorageLive(_8);
67-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
67+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
6868
// _8 = ();
6969
// StorageDead(_8);
7070
// _4 = const 42i32;
@@ -73,7 +73,7 @@ fn main() {
7373
// }
7474
// bb5: {
7575
// StorageLive(_7);
76-
// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
76+
// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []);
7777
// _7 = ();
7878
// StorageDead(_7);
7979
// _4 = const 21i32;

src/test/pretty/asm-clobbers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#![feature(asm)]
1+
#![feature(llvm_asm)]
22

3-
pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }
3+
pub fn main() { unsafe { llvm_asm!("" : : : "hello", "world") }; }

src/test/pretty/asm-options.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#![feature(asm)]
1+
#![feature(llvm_asm)]
22

33
// pp-exact
44

55
pub fn main() {
66
unsafe {
7-
asm!("" : : : : "volatile");
8-
asm!("" : : : : "alignstack");
9-
asm!("" : : : : "intel");
7+
llvm_asm!("" : : : : "volatile");
8+
llvm_asm!("" : : : : "alignstack");
9+
llvm_asm!("" : : : : "intel");
1010
}
1111
}

0 commit comments

Comments
 (0)