From 1cc521ef9d8a8a2eb48f0e11ddfc1e70734aff10 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 14 Feb 2020 16:54:40 +0000 Subject: [PATCH] Update tests to use llvm_asm! --- src/librustc_error_codes/error_codes/E0668.md | 2 +- src/test/codegen/no-output-asm-is-volatile.rs | 4 +- .../compile-fail/asm-src-loc-codegen-units.rs | 4 +- src/test/compile-fail/asm-src-loc.rs | 4 +- src/test/incremental/hashes/inline_asm.rs | 146 +++++++++--------- src/test/mir-opt/unreachable_asm.rs | 8 +- src/test/mir-opt/unreachable_asm_2.rs | 14 +- src/test/pretty/asm-clobbers.rs | 4 +- src/test/pretty/asm-options.rs | 8 +- src/test/pretty/raw-str-nonexpr.rs | 4 +- .../intrinsic-unreachable/exit-ret.rs | 4 +- .../intrinsic-unreachable/exit-unreachable.rs | 4 +- src/test/ui/abi/abi-sysv64-register-usage.rs | 58 +++---- src/test/ui/asm-concat-src.rs | 4 +- src/test/ui/asm-in-moved.rs | 4 +- src/test/ui/asm-in-out-operand.rs | 12 +- src/test/ui/asm-indirect-memory.rs | 8 +- src/test/ui/asm-out-assign.rs | 6 +- src/test/ui/asm/asm-bad-clobber.rs | 4 +- src/test/ui/asm/asm-bad-clobber.stderr | 6 +- src/test/ui/asm/asm-in-bad-modifier.rs | 6 +- src/test/ui/asm/asm-in-bad-modifier.stderr | 12 +- src/test/ui/asm/asm-literal-escaping.rs | 4 +- src/test/ui/asm/asm-misplaced-option.rs | 6 +- src/test/ui/asm/asm-misplaced-option.stderr | 12 +- src/test/ui/asm/asm-out-assign-imm.rs | 4 +- src/test/ui/asm/asm-out-assign-imm.stderr | 6 +- src/test/ui/asm/asm-out-no-modifier.rs | 4 +- src/test/ui/asm/asm-out-no-modifier.stderr | 6 +- src/test/ui/asm/asm-out-read-uninit.rs | 4 +- src/test/ui/asm/asm-out-read-uninit.stderr | 6 +- src/test/ui/asm/asm-parse-errors.rs | 24 +-- src/test/ui/asm/asm-parse-errors.stderr | 64 ++++---- src/test/ui/asm/issue-51431.rs | 6 +- src/test/ui/asm/issue-51431.stderr | 6 +- src/test/ui/asm/issue-62046.rs | 4 +- src/test/ui/asm/issue-62046.stderr | 4 +- src/test/ui/asm/issue-69092.rs | 4 +- src/test/ui/asm/issue-69092.stderr | 4 +- src/test/ui/ast-json/ast-json-ice.rs | 4 +- src/test/ui/borrowck/borrowck-asm.rs | 18 +-- src/test/ui/borrowck/borrowck-asm.stderr | 44 +++--- src/test/ui/error-codes/E0660.rs | 6 +- src/test/ui/error-codes/E0660.stderr | 8 +- src/test/ui/error-codes/E0661.rs | 4 +- src/test/ui/error-codes/E0661.stderr | 6 +- src/test/ui/error-codes/E0662.rs | 10 +- src/test/ui/error-codes/E0662.stderr | 6 +- src/test/ui/error-codes/E0663.rs | 10 +- src/test/ui/error-codes/E0663.stderr | 6 +- src/test/ui/error-codes/E0664.rs | 12 +- src/test/ui/error-codes/E0664.stderr | 6 +- src/test/ui/feature-gates/feature-gate-asm.rs | 1 + .../ui/feature-gates/feature-gate-asm.stderr | 11 +- .../ui/feature-gates/feature-gate-asm2.rs | 1 + .../ui/feature-gates/feature-gate-asm2.stderr | 11 +- src/test/ui/inline-asm-bad-constraint.rs | 8 +- src/test/ui/inline-asm-bad-constraint.stderr | 12 +- src/test/ui/inline-asm-bad-operand.rs | 18 +-- src/test/ui/inline-asm-bad-operand.stderr | 38 ++--- src/test/ui/issues/issue-14936.rs | 10 +- src/test/ui/issues/issue-23458.rs | 6 +- src/test/ui/issues/issue-23458.stderr | 8 +- src/test/ui/issues/issue-33264.rs | 22 +-- src/test/ui/issues/issue-37366.rs | 4 +- src/test/ui/issues/issue-37433.rs | 6 +- src/test/ui/issues/issue-37433.stderr | 6 +- .../issue-53787-inline-assembler-macro.rs | 4 +- src/test/ui/issues/issue-9129.rs | 2 +- .../macros/macro-expanded-include/foo/mod.rs | 2 +- .../ui/macros/macro-expanded-include/test.rs | 4 +- src/test/ui/macros/macros-nonfatal-errors.rs | 4 +- .../ui/macros/macros-nonfatal-errors.stderr | 6 +- src/test/ui/out-of-stack.rs | 4 +- 74 files changed, 421 insertions(+), 401 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0668.md b/src/librustc_error_codes/error_codes/E0668.md index 5d7c4cda05b28..3b43a1bcae9e6 100644 --- a/src/librustc_error_codes/error_codes/E0668.md +++ b/src/librustc_error_codes/error_codes/E0668.md @@ -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; diff --git a/src/test/codegen/no-output-asm-is-volatile.rs b/src/test/codegen/no-output-asm-is-volatile.rs index 47b38d2941742..40376218908d1 100644 --- a/src/test/codegen/no-output-asm-is-volatile.rs +++ b/src/test/codegen/no-output-asm-is-volatile.rs @@ -1,6 +1,6 @@ // compile-flags: -O -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type = "lib"] // Check that inline assembly expressions without any outputs @@ -9,6 +9,6 @@ // CHECK-LABEL: @assembly #[no_mangle] pub fn assembly() { - unsafe { asm!("") } + unsafe { llvm_asm!("") } // CHECK: tail call void asm sideeffect "", {{.*}} } diff --git a/src/test/compile-fail/asm-src-loc-codegen-units.rs b/src/test/compile-fail/asm-src-loc-codegen-units.rs index 798eb32181ce7..c9415aed930d5 100644 --- a/src/test/compile-fail/asm-src-loc-codegen-units.rs +++ b/src/test/compile-fail/asm-src-loc-codegen-units.rs @@ -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 } } diff --git a/src/test/compile-fail/asm-src-loc.rs b/src/test/compile-fail/asm-src-loc.rs index 0b60256e7fd09..7c87f370d4f68 100644 --- a/src/test/compile-fail/asm-src-loc.rs +++ b/src/test/compile-fail/asm-src-loc.rs @@ -1,9 +1,9 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("nowayisthisavalidinstruction"); //~ ERROR instruction + llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction } } diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index fb3c6378f74ab..3eaffc440615f 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -11,7 +11,7 @@ #![allow(warnings)] #![feature(rustc_attrs)] -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type="rlib"] @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/src/test/mir-opt/unreachable_asm.rs b/src/test/mir-opt/unreachable_asm.rs index ca614ac32b764..990141657f467 100644 --- a/src/test/mir-opt/unreachable_asm.rs +++ b/src/test/mir-opt/unreachable_asm.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(asm)] +#![feature(llvm_asm)] enum Empty {} @@ -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 { } } } @@ -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); @@ -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); diff --git a/src/test/mir-opt/unreachable_asm_2.rs b/src/test/mir-opt/unreachable_asm_2.rs index 8fdbcfb5cab7f..0851e24d410e7 100644 --- a/src/test/mir-opt/unreachable_asm_2.rs +++ b/src/test/mir-opt/unreachable_asm_2.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(asm)] +#![feature(llvm_asm)] enum Empty {} @@ -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; } @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/src/test/pretty/asm-clobbers.rs b/src/test/pretty/asm-clobbers.rs index 1bc9f008bbbf9..2c09646e47e4a 100644 --- a/src/test/pretty/asm-clobbers.rs +++ b/src/test/pretty/asm-clobbers.rs @@ -1,3 +1,3 @@ -#![feature(asm)] +#![feature(llvm_asm)] -pub fn main() { unsafe { asm!("" : : : "hello", "world") }; } +pub fn main() { unsafe { llvm_asm!("" : : : "hello", "world") }; } diff --git a/src/test/pretty/asm-options.rs b/src/test/pretty/asm-options.rs index 5c2bbd9edd931..86a881bfbd18a 100644 --- a/src/test/pretty/asm-options.rs +++ b/src/test/pretty/asm-options.rs @@ -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"); } } diff --git a/src/test/pretty/raw-str-nonexpr.rs b/src/test/pretty/raw-str-nonexpr.rs index cb23124f2103f..41227898f24a8 100644 --- a/src/test/pretty/raw-str-nonexpr.rs +++ b/src/test/pretty/raw-str-nonexpr.rs @@ -1,8 +1,8 @@ // pp-exact -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(foo = r#"just parse this"#)] extern crate blah as blah; -fn main() { unsafe { asm!(r###"blah"###); } } +fn main() { unsafe { llvm_asm!(r###"blah"###); } } diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs index 936001c43a48f..2e81667cf39c6 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs @@ -1,11 +1,11 @@ -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type="lib"] #[deny(unreachable_code)] pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - asm!("" :: "r"(n) :: "volatile"); + llvm_asm!("" :: "r"(n) :: "volatile"); // Can't actually reach this point, but rustc doesn't know that. } // This return value is just here to generate some extra code for a return diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs index 00b09cb9460b1..fb3848b0db617 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs @@ -1,4 +1,4 @@ -#![feature(asm, core_intrinsics)] +#![feature(llvm_asm, core_intrinsics)] #![crate_type="lib"] use std::intrinsics; @@ -7,7 +7,7 @@ use std::intrinsics; pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - asm!("" :: "r"(n) :: "volatile"); + llvm_asm!("" :: "r"(n) :: "volatile"); intrinsics::unreachable() } // This return value is just here to generate some extra code for a return diff --git a/src/test/ui/abi/abi-sysv64-register-usage.rs b/src/test/ui/abi/abi-sysv64-register-usage.rs index 0c7e2d906b7c1..fcdff59ffa984 100644 --- a/src/test/ui/abi/abi-sysv64-register-usage.rs +++ b/src/test/ui/abi/abi-sysv64-register-usage.rs @@ -6,7 +6,7 @@ // ignore-arm // ignore-aarch64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(target_arch = "x86_64")] pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64, @@ -54,34 +54,34 @@ pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct pub fn main() { let result: i64; unsafe { - asm!("mov rdi, 1; - mov rsi, 2; - mov rdx, 3; - mov rcx, 4; - mov r8, 5; - mov r9, 6; - mov eax, 0x3F800000; - movd xmm0, eax; - mov eax, 0x40000000; - movd xmm1, eax; - mov eax, 0x40800000; - movd xmm2, eax; - mov eax, 0x41000000; - movd xmm3, eax; - mov eax, 0x41800000; - movd xmm4, eax; - mov eax, 0x42000000; - movd xmm5, eax; - mov eax, 0x42800000; - movd xmm6, eax; - mov eax, 0x43000000; - movd xmm7, eax; - call r10 - " - : "={rax}"(result) - : "{r10}"(all_the_registers as usize) - : "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11", "cc", "memory" - : "intel", "alignstack" + llvm_asm!("mov rdi, 1; + mov rsi, 2; + mov rdx, 3; + mov rcx, 4; + mov r8, 5; + mov r9, 6; + mov eax, 0x3F800000; + movd xmm0, eax; + mov eax, 0x40000000; + movd xmm1, eax; + mov eax, 0x40800000; + movd xmm2, eax; + mov eax, 0x41000000; + movd xmm3, eax; + mov eax, 0x41800000; + movd xmm4, eax; + mov eax, 0x42000000; + movd xmm5, eax; + mov eax, 0x42800000; + movd xmm6, eax; + mov eax, 0x43000000; + movd xmm7, eax; + call r10 + " + : "={rax}"(result) + : "{r10}"(all_the_registers as usize) + : "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11", "cc", "memory" + : "intel", "alignstack" ) } assert_eq!(result, 42); diff --git a/src/test/ui/asm-concat-src.rs b/src/test/ui/asm-concat-src.rs index c4160bfeca105..1dc1c859c6b0e 100644 --- a/src/test/ui/asm-concat-src.rs +++ b/src/test/ui/asm-concat-src.rs @@ -2,8 +2,8 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no asm -#![feature(asm)] +#![feature(llvm_asm)] pub fn main() { - unsafe { asm!(concat!("", "")) }; + unsafe { llvm_asm!(concat!("", "")) }; } diff --git a/src/test/ui/asm-in-moved.rs b/src/test/ui/asm-in-moved.rs index 6525d2f53b099..35f4d92c8ffbc 100644 --- a/src/test/ui/asm-in-moved.rs +++ b/src/test/ui/asm-in-moved.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #![allow(dead_code)] use std::cell::Cell; @@ -20,7 +20,7 @@ fn main() { let _y: Box; let x = Box::new(NoisyDrop(&status)); unsafe { - asm!("mov $1, $0" : "=r"(_y) : "r"(x)); + llvm_asm!("mov $1, $0" : "=r"(_y) : "r"(x)); } assert_eq!(status.get(), "alive"); } diff --git a/src/test/ui/asm-in-out-operand.rs b/src/test/ui/asm-in-out-operand.rs index 13d0363a6a070..acefabd8a666e 100644 --- a/src/test/ui/asm-in-out-operand.rs +++ b/src/test/ui/asm-in-out-operand.rs @@ -1,21 +1,21 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] unsafe fn next_power_of_2(n: u32) -> u32 { let mut tmp = n; - asm!("dec $0" : "+rm"(tmp) :: "cc"); + llvm_asm!("dec $0" : "+rm"(tmp) :: "cc"); let mut shift = 1_u32; while shift <= 16 { - asm!( + llvm_asm!( "shr %cl, $2 or $2, $0 shl $$1, $1" : "+&rm"(tmp), "+{ecx}"(shift) : "r"(tmp) : "cc" ); } - asm!("inc $0" : "+rm"(tmp) :: "cc"); + llvm_asm!("inc $0" : "+rm"(tmp) :: "cc"); return tmp; } @@ -30,7 +30,7 @@ pub fn main() { let x: isize; unsafe { // Treat the output as initialization. - asm!( + llvm_asm!( "shl $2, $1 add $3, $1 mov $1, $0" @@ -47,7 +47,7 @@ pub fn main() { // Assignment to mutable. // Early clobber "&": // Forbids the use of a single register by both operands. - asm!("shr $$2, $1; add $1, $0" : "+&r"(x) : "r"(x) : "cc"); + llvm_asm!("shr $$2, $1; add $1, $0" : "+&r"(x) : "r"(x) : "cc"); } assert_eq!(x, 60); } diff --git a/src/test/ui/asm-indirect-memory.rs b/src/test/ui/asm-indirect-memory.rs index 2e8011af50295..556ad83a4ead8 100644 --- a/src/test/ui/asm-indirect-memory.rs +++ b/src/test/ui/asm-indirect-memory.rs @@ -1,12 +1,12 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn read(ptr: &u32) -> u32 { let out: u32; unsafe { - asm!("mov $1, $0" : "=r" (out) : "*m" (ptr)); + llvm_asm!("mov $1, $0" : "=r" (out) : "*m" (ptr)); } out } @@ -14,7 +14,7 @@ fn read(ptr: &u32) -> u32 { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn write(ptr: &mut u32, val: u32) { unsafe { - asm!("mov $1, $0" : "=*m" (ptr) : "r" (val)); + llvm_asm!("mov $1, $0" : "=*m" (ptr) : "r" (val)); } } @@ -22,7 +22,7 @@ fn write(ptr: &mut u32, val: u32) { fn replace(ptr: &mut u32, val: u32) -> u32 { let out: u32; unsafe { - asm!("mov $0, $1; mov $2, $0" : "+*m" (ptr), "=&r" (out) : "r" (val)); + llvm_asm!("mov $0, $1; mov $2, $0" : "+*m" (ptr), "=&r" (out) : "r" (val)); } out } diff --git a/src/test/ui/asm-out-assign.rs b/src/test/ui/asm-out-assign.rs index ed63d1b4d492a..321f28565ff18 100644 --- a/src/test/ui/asm-out-assign.rs +++ b/src/test/ui/asm-out-assign.rs @@ -1,13 +1,13 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn main() { let x: isize; unsafe { // Treat the output as initialization. - asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); } assert_eq!(x, 5); @@ -16,7 +16,7 @@ pub fn main() { unsafe { // Assignment to mutable. - asm!("mov $1, $0" : "=r"(x) : "r"(x + 7)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x + 7)); } assert_eq!(x, 13); } diff --git a/src/test/ui/asm/asm-bad-clobber.rs b/src/test/ui/asm/asm-bad-clobber.rs index 8406a1cc7a824..9f5662cbd1e93 100644 --- a/src/test/ui/asm/asm-bad-clobber.rs +++ b/src/test/ui/asm/asm-bad-clobber.rs @@ -11,7 +11,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] @@ -19,7 +19,7 @@ pub fn main() { unsafe { // clobber formatted as register input/output - asm!("xor %eax, %eax" : : : "{eax}"); + llvm_asm!("xor %eax, %eax" : : : "{eax}"); //~^ ERROR clobber should not be surrounded by braces } } diff --git a/src/test/ui/asm/asm-bad-clobber.stderr b/src/test/ui/asm/asm-bad-clobber.stderr index a279421241fac..8c5d04694c497 100644 --- a/src/test/ui/asm/asm-bad-clobber.stderr +++ b/src/test/ui/asm/asm-bad-clobber.stderr @@ -1,8 +1,8 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/asm-bad-clobber.rs:22:37 + --> $DIR/asm-bad-clobber.rs:22:42 | -LL | asm!("xor %eax, %eax" : : : "{eax}"); - | ^^^^^^^ +LL | llvm_asm!("xor %eax, %eax" : : : "{eax}"); + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-in-bad-modifier.rs b/src/test/ui/asm/asm-in-bad-modifier.rs index 38cd11e251586..b791ec3e8c8b1 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.rs +++ b/src/test/ui/asm/asm-in-bad-modifier.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -20,8 +20,8 @@ pub fn main() { let x: isize; let y: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' - asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' + llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' + llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' } foo(x); foo(y); diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr index d45b3e57038cd..f1624f74a70ac 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.stderr +++ b/src/test/ui/asm/asm-in-bad-modifier.stderr @@ -1,14 +1,14 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/asm-in-bad-modifier.rs:23:39 + --> $DIR/asm-in-bad-modifier.rs:23:44 | -LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5)); + | ^^^^ error[E0663]: input operand constraint contains '+' - --> $DIR/asm-in-bad-modifier.rs:24:39 + --> $DIR/asm-in-bad-modifier.rs:24:44 | -LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5)); + | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-literal-escaping.rs b/src/test/ui/asm/asm-literal-escaping.rs index 8d464e752e637..5d45f5084c5ee 100644 --- a/src/test/ui/asm/asm-literal-escaping.rs +++ b/src/test/ui/asm/asm-literal-escaping.rs @@ -1,12 +1,12 @@ // build-pass // only-x86_64 -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { // "nop" :: "r"(x) : "eax" : "volatile" let x = 10; - asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); + llvm_asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); } } diff --git a/src/test/ui/asm/asm-misplaced-option.rs b/src/test/ui/asm/asm-misplaced-option.rs index 14ff4c2e981b3..3c44fc90ef3f2 100644 --- a/src/test/ui/asm/asm-misplaced-option.rs +++ b/src/test/ui/asm/asm-misplaced-option.rs @@ -12,7 +12,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] @@ -21,14 +21,14 @@ fn main() { let mut x: isize = 0; unsafe { // extra colon - asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); //~^ WARNING unrecognized option } assert_eq!(x, 5); unsafe { // comma in place of a colon - asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); + llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); //~^ WARNING expected a clobber, found an option } assert_eq!(x, 13); diff --git a/src/test/ui/asm/asm-misplaced-option.stderr b/src/test/ui/asm/asm-misplaced-option.stderr index 3d4b28c3dc444..ea9267c643b13 100644 --- a/src/test/ui/asm/asm-misplaced-option.stderr +++ b/src/test/ui/asm/asm-misplaced-option.stderr @@ -1,12 +1,12 @@ warning: unrecognized option - --> $DIR/asm-misplaced-option.rs:24:64 + --> $DIR/asm-misplaced-option.rs:24:69 | -LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); + | ^^^^ warning: expected a clobber, found an option - --> $DIR/asm-misplaced-option.rs:31:80 + --> $DIR/asm-misplaced-option.rs:31:85 | -LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); - | ^^^^^^^^^^ +LL | llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); + | ^^^^^^^^^^ diff --git a/src/test/ui/asm/asm-out-assign-imm.rs b/src/test/ui/asm/asm-out-assign-imm.rs index 7a8be2a133ec7..1a46879f9f291 100644 --- a/src/test/ui/asm/asm-out-assign-imm.rs +++ b/src/test/ui/asm/asm-out-assign-imm.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -21,7 +21,7 @@ pub fn main() { x = 1; foo(x); unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(5)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); //~^ ERROR cannot assign twice to immutable variable `x` } foo(x); diff --git a/src/test/ui/asm/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr index ac38218b8492f..feec61b4fc6ef 100644 --- a/src/test/ui/asm/asm-out-assign-imm.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.stderr @@ -1,13 +1,13 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:24:34 + --> $DIR/asm-out-assign-imm.rs:24:39 | LL | let x: isize; | - help: make this binding mutable: `mut x` LL | x = 1; | ----- first assignment to `x` ... -LL | asm!("mov $1, $0" : "=r"(x) : "r"(5)); - | ^ cannot assign twice to immutable variable +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); + | ^ cannot assign twice to immutable variable error: aborting due to previous error diff --git a/src/test/ui/asm/asm-out-no-modifier.rs b/src/test/ui/asm/asm-out-no-modifier.rs index d9142b9f2e0c8..d198437c50894 100644 --- a/src/test/ui/asm/asm-out-no-modifier.rs +++ b/src/test/ui/asm/asm-out-no-modifier.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' + llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' } foo(x); } diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr index 99134ceba3327..1c9e108f910c6 100644 --- a/src/test/ui/asm/asm-out-no-modifier.stderr +++ b/src/test/ui/asm/asm-out-no-modifier.stderr @@ -1,8 +1,8 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/asm-out-no-modifier.rs:22:29 + --> $DIR/asm-out-no-modifier.rs:22:34 | -LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); - | ^^^ +LL | llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); + | ^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-out-read-uninit.rs b/src/test/ui/asm/asm-out-read-uninit.rs index 78458ff60d4aa..d45498d4bb4a1 100644 --- a/src/test/ui/asm/asm-out-read-uninit.rs +++ b/src/test/ui/asm/asm-out-read-uninit.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(x)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~^ ERROR use of possibly-uninitialized variable: `x` } foo(x); diff --git a/src/test/ui/asm/asm-out-read-uninit.stderr b/src/test/ui/asm/asm-out-read-uninit.stderr index 71aeda2ad4d2e..3c3f3a6febb5a 100644 --- a/src/test/ui/asm/asm-out-read-uninit.stderr +++ b/src/test/ui/asm/asm-out-read-uninit.stderr @@ -1,8 +1,8 @@ error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/asm-out-read-uninit.rs:22:43 + --> $DIR/asm-out-read-uninit.rs:22:48 | -LL | asm!("mov $1, $0" : "=r"(x) : "r"(x)); - | ^ use of possibly-uninitialized `x` +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); + | ^ use of possibly-uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/asm/asm-parse-errors.rs b/src/test/ui/asm/asm-parse-errors.rs index e712ac5826e2c..d458be815296b 100644 --- a/src/test/ui/asm/asm-parse-errors.rs +++ b/src/test/ui/asm/asm-parse-errors.rs @@ -1,15 +1,15 @@ -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!(); //~ ERROR requires a string literal as an argument - asm!("nop" : struct); //~ ERROR expected string literal - asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal - asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` - asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression - asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal - asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` - asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression - asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal - asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal - asm!(123); //~ ERROR inline assembly must be a string literal + llvm_asm!(); //~ ERROR requires a string literal as an argument + llvm_asm!("nop" : struct); //~ ERROR expected string literal + llvm_asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal + llvm_asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` + llvm_asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression + llvm_asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal + llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` + llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression + llvm_asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal + llvm_asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal + llvm_asm!(123); //~ ERROR inline assembly must be a string literal } diff --git a/src/test/ui/asm/asm-parse-errors.stderr b/src/test/ui/asm/asm-parse-errors.stderr index 2b29332fef5e5..64f295c3b3698 100644 --- a/src/test/ui/asm/asm-parse-errors.stderr +++ b/src/test/ui/asm/asm-parse-errors.stderr @@ -1,68 +1,68 @@ error: macro requires a string literal as an argument --> $DIR/asm-parse-errors.rs:4:5 | -LL | asm!(); - | ^^^^^^^ string literal required +LL | llvm_asm!(); + | ^^^^^^^^^^^^ string literal required error: expected string literal - --> $DIR/asm-parse-errors.rs:5:18 + --> $DIR/asm-parse-errors.rs:5:23 | -LL | asm!("nop" : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("nop" : struct); + | ^^^^^^ not a string literal error: expected string literal - --> $DIR/asm-parse-errors.rs:6:30 + --> $DIR/asm-parse-errors.rs:6:35 | -LL | asm!("mov %eax, $$0x2" : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov %eax, $$0x2" : struct); + | ^^^^^^ not a string literal error: expected `(`, found keyword `struct` - --> $DIR/asm-parse-errors.rs:7:39 + --> $DIR/asm-parse-errors.rs:7:44 | -LL | asm!("mov %eax, $$0x2" : "={eax}" struct); - | ^^^^^^ expected `(` +LL | llvm_asm!("mov %eax, $$0x2" : "={eax}" struct); + | ^^^^^^ expected `(` error: expected expression, found keyword `struct` - --> $DIR/asm-parse-errors.rs:8:39 + --> $DIR/asm-parse-errors.rs:8:44 | -LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); - | ^^^^^^ expected expression +LL | llvm_asm!("mov %eax, $$0x2" : "={eax}"(struct)); + | ^^^^^^ expected expression error: expected string literal - --> $DIR/asm-parse-errors.rs:9:44 + --> $DIR/asm-parse-errors.rs:9:49 | -LL | asm!("in %dx, %al" : "={al}"(result) : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : struct); + | ^^^^^^ not a string literal error: expected `(`, found keyword `struct` - --> $DIR/asm-parse-errors.rs:10:51 + --> $DIR/asm-parse-errors.rs:10:56 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); - | ^^^^^^ expected `(` +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); + | ^^^^^^ expected `(` error: expected expression, found keyword `struct` - --> $DIR/asm-parse-errors.rs:11:51 + --> $DIR/asm-parse-errors.rs:11:56 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); - | ^^^^^^ expected expression +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); + | ^^^^^^ expected expression error: expected string literal - --> $DIR/asm-parse-errors.rs:12:36 + --> $DIR/asm-parse-errors.rs:12:41 | -LL | asm!("mov $$0x200, %eax" : : : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov $$0x200, %eax" : : : struct); + | ^^^^^^ not a string literal error: expected string literal - --> $DIR/asm-parse-errors.rs:13:45 + --> $DIR/asm-parse-errors.rs:13:50 | -LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov eax, 2" : "={eax}"(foo) : : : struct); + | ^^^^^^ not a string literal error: inline assembly must be a string literal - --> $DIR/asm-parse-errors.rs:14:10 + --> $DIR/asm-parse-errors.rs:14:15 | -LL | asm!(123); - | ^^^ +LL | llvm_asm!(123); + | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/asm/issue-51431.rs b/src/test/ui/asm/issue-51431.rs index 4cef42d17d600..ca06bdab27b96 100644 --- a/src/test/ui/asm/issue-51431.rs +++ b/src/test/ui/asm/issue-51431.rs @@ -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! {"mov $0,$1"::"0"("bx"),"1"(0x00)} + llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} //~^ ERROR: invalid value for constraint in inline assembly } } diff --git a/src/test/ui/asm/issue-51431.stderr b/src/test/ui/asm/issue-51431.stderr index a024f3311f186..b4b39a2a44ec3 100644 --- a/src/test/ui/asm/issue-51431.stderr +++ b/src/test/ui/asm/issue-51431.stderr @@ -1,8 +1,8 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-51431.rs:8:32 + --> $DIR/issue-51431.rs:8:37 | -LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} - | ^^^^ +LL | llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} + | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/issue-62046.rs b/src/test/ui/asm/issue-62046.rs index 105dadd5fd373..fd4d9bdd23dbf 100644 --- a/src/test/ui/asm/issue-62046.rs +++ b/src/test/ui/asm/issue-62046.rs @@ -1,11 +1,11 @@ // build-fail // ignore-emscripten no asm! support -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("nop" : "+r"("r15")); + llvm_asm!("nop" : "+r"("r15")); //~^ malformed inline assembly } } diff --git a/src/test/ui/asm/issue-62046.stderr b/src/test/ui/asm/issue-62046.stderr index a38a300548d48..cf27052df05aa 100644 --- a/src/test/ui/asm/issue-62046.stderr +++ b/src/test/ui/asm/issue-62046.stderr @@ -1,8 +1,8 @@ error[E0668]: malformed inline assembly --> $DIR/issue-62046.rs:8:9 | -LL | asm!("nop" : "+r"("r15")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" : "+r"("r15")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/asm/issue-69092.rs b/src/test/ui/asm/issue-69092.rs index caa5c2e0b9f96..ecce7bfdf5bba 100644 --- a/src/test/ui/asm/issue-69092.rs +++ b/src/test/ui/asm/issue-69092.rs @@ -2,9 +2,9 @@ // ignore-emscripten no asm! support // Regression test for #69092 -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - unsafe { asm!(".ascii \"Xen\0\""); } + unsafe { llvm_asm!(".ascii \"Xen\0\""); } //~^ ERROR: :1:9: error: expected string in '.ascii' directive } diff --git a/src/test/ui/asm/issue-69092.stderr b/src/test/ui/asm/issue-69092.stderr index 5661097cb8b80..35f77edc3c402 100644 --- a/src/test/ui/asm/issue-69092.stderr +++ b/src/test/ui/asm/issue-69092.stderr @@ -4,8 +4,8 @@ error: :1:9: error: expected string in '.ascii' directive --> $DIR/issue-69092.rs:8:14 | -LL | unsafe { asm!(".ascii \"Xen\0\""); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe { llvm_asm!(".ascii \"Xen\0\""); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/ast-json/ast-json-ice.rs b/src/test/ui/ast-json/ast-json-ice.rs index e8a622e1b8772..60e6c88fc7924 100644 --- a/src/test/ui/ast-json/ast-json-ice.rs +++ b/src/test/ui/ast-json/ast-json-ice.rs @@ -8,7 +8,7 @@ // check-pass // dont-check-compiler-stdout - don't check for any AST change. -#![feature(asm)] +#![feature(llvm_asm)] enum V { A(i32), @@ -30,7 +30,7 @@ fn main() { target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))] - unsafe { asm!(""::::); } + unsafe { llvm_asm!(""::::); } let x: (i32) = 35; let y = x as i64<> + 5; diff --git a/src/test/ui/borrowck/borrowck-asm.rs b/src/test/ui/borrowck/borrowck-asm.rs index c1b0f39f9366c..d16b424536aac 100644 --- a/src/test/ui/borrowck/borrowck-asm.rs +++ b/src/test/ui/borrowck/borrowck-asm.rs @@ -6,7 +6,7 @@ // ignore-sparc // ignore-sparc64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64", @@ -19,7 +19,7 @@ mod test_cases { let y: &mut isize; let x = &mut 0isize; unsafe { - asm!("nop" : : "r"(x)); + llvm_asm!("nop" : : "r"(x)); } let z = x; //~ ERROR use of moved value: `x` } @@ -28,7 +28,7 @@ mod test_cases { let mut x = 3; let y = &mut x; unsafe { - asm!("nop" : : "r"(x)); //~ ERROR cannot use + llvm_asm!("nop" : : "r"(x)); //~ ERROR cannot use } let z = y; } @@ -36,12 +36,12 @@ mod test_cases { fn out_is_assign() { let x = 3; unsafe { - asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice + llvm_asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice } let mut a = &mut 3; let b = &*a; unsafe { - asm!("nop" : "=r"(a)); // OK, Shallow write to `a` + llvm_asm!("nop" : "=r"(a)); // OK, Shallow write to `a` } let c = b; let d = *a; @@ -50,14 +50,14 @@ mod test_cases { fn rw_is_assign() { let x = 3; unsafe { - asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice + llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice } } fn indirect_is_not_init() { let x: i32; unsafe { - asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable + llvm_asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable } } @@ -65,7 +65,7 @@ mod test_cases { let mut x = &mut 3; let y = &*x; unsafe { - asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed + llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed } let z = y; } @@ -73,7 +73,7 @@ mod test_cases { fn two_moves() { let x = &mut 2; unsafe { - asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value + llvm_asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value } } } diff --git a/src/test/ui/borrowck/borrowck-asm.stderr b/src/test/ui/borrowck/borrowck-asm.stderr index f85b5983acced..d7e94bd34d35b 100644 --- a/src/test/ui/borrowck/borrowck-asm.stderr +++ b/src/test/ui/borrowck/borrowck-asm.stderr @@ -4,26 +4,26 @@ error[E0382]: use of moved value: `x` LL | let x = &mut 0isize; | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait LL | unsafe { -LL | asm!("nop" : : "r"(x)); - | - value moved here +LL | llvm_asm!("nop" : : "r"(x)); + | - value moved here LL | } LL | let z = x; | ^ value used here after move error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-asm.rs:31:32 + --> $DIR/borrowck-asm.rs:31:37 | LL | let y = &mut x; | ------ borrow of `x` occurs here LL | unsafe { -LL | asm!("nop" : : "r"(x)); - | ^ use of borrowed `x` +LL | llvm_asm!("nop" : : "r"(x)); + | ^ use of borrowed `x` LL | } LL | let z = y; | - borrow later used here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:39:31 + --> $DIR/borrowck-asm.rs:39:36 | LL | let x = 3; | - @@ -31,11 +31,11 @@ LL | let x = 3; | first assignment to `x` | help: make this binding mutable: `mut x` LL | unsafe { -LL | asm!("nop" : "=r"(x)); - | ^ cannot assign twice to immutable variable +LL | llvm_asm!("nop" : "=r"(x)); + | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:53:31 + --> $DIR/borrowck-asm.rs:53:36 | LL | let x = 3; | - @@ -43,37 +43,37 @@ LL | let x = 3; | first assignment to `x` | help: make this binding mutable: `mut x` LL | unsafe { -LL | asm!("nop" : "+r"(x)); - | ^ cannot assign twice to immutable variable +LL | llvm_asm!("nop" : "+r"(x)); + | ^ cannot assign twice to immutable variable error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:60:32 + --> $DIR/borrowck-asm.rs:60:37 | -LL | asm!("nop" : "=*r"(x)); - | ^ use of possibly-uninitialized `x` +LL | llvm_asm!("nop" : "=*r"(x)); + | ^ use of possibly-uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:68:31 + --> $DIR/borrowck-asm.rs:68:36 | LL | let y = &*x; | --- borrow of `x` occurs here LL | unsafe { -LL | asm!("nop" : "+r"(x)); - | ^ assignment to borrowed `x` occurs here +LL | llvm_asm!("nop" : "+r"(x)); + | ^ assignment to borrowed `x` occurs here LL | } LL | let z = y; | - borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:76:40 + --> $DIR/borrowck-asm.rs:76:45 | LL | let x = &mut 2; | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait LL | unsafe { -LL | asm!("nop" : : "r"(x), "r"(x) ); - | - ^ value used here after move - | | - | value moved here +LL | llvm_asm!("nop" : : "r"(x), "r"(x) ); + | - ^ value used here after move + | | + | value moved here error: aborting due to 7 previous errors diff --git a/src/test/ui/error-codes/E0660.rs b/src/test/ui/error-codes/E0660.rs index 6280d39061035..842ae59ee8deb 100644 --- a/src/test/ui/error-codes/E0660.rs +++ b/src/test/ui/error-codes/E0660.rs @@ -1,9 +1,9 @@ -#![feature(asm)] +#![feature(llvm_asm)] fn main() { let a; - asm!("nop" "nop"); + llvm_asm!("nop" "nop"); //~^ ERROR E0660 - asm!("nop" "nop" : "=r"(a)); + llvm_asm!("nop" "nop" : "=r"(a)); //~^ ERROR E0660 } diff --git a/src/test/ui/error-codes/E0660.stderr b/src/test/ui/error-codes/E0660.stderr index d355531ef5d91..69288ea6fcdb3 100644 --- a/src/test/ui/error-codes/E0660.stderr +++ b/src/test/ui/error-codes/E0660.stderr @@ -1,14 +1,14 @@ error[E0660]: malformed inline assembly --> $DIR/E0660.rs:5:5 | -LL | asm!("nop" "nop"); - | ^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" "nop"); + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0660]: malformed inline assembly --> $DIR/E0660.rs:7:5 | -LL | asm!("nop" "nop" : "=r"(a)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" "nop" : "=r"(a)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0661.rs b/src/test/ui/error-codes/E0661.rs index 5ac0c415ae1b2..1099edd848b28 100644 --- a/src/test/ui/error-codes/E0661.rs +++ b/src/test/ui/error-codes/E0661.rs @@ -1,9 +1,9 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { let a; //~ ERROR type annotations needed - asm!("nop" : "r"(a)); + llvm_asm!("nop" : "r"(a)); //~^ ERROR E0661 } diff --git a/src/test/ui/error-codes/E0661.stderr b/src/test/ui/error-codes/E0661.stderr index 6e849649aca2a..fe3887e72604d 100644 --- a/src/test/ui/error-codes/E0661.stderr +++ b/src/test/ui/error-codes/E0661.stderr @@ -1,8 +1,8 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/E0661.rs:7:18 + --> $DIR/E0661.rs:7:23 | -LL | asm!("nop" : "r"(a)); - | ^^^ +LL | llvm_asm!("nop" : "r"(a)); + | ^^^ error[E0282]: type annotations needed --> $DIR/E0661.rs:6:9 diff --git a/src/test/ui/error-codes/E0662.rs b/src/test/ui/error-codes/E0662.rs index 343ed27f83f7e..095005999039f 100644 --- a/src/test/ui/error-codes/E0662.rs +++ b/src/test/ui/error-codes/E0662.rs @@ -1,10 +1,10 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("xor %eax, %eax" - : - : "=test"("a") //~ ERROR E0662 - ); + llvm_asm!("xor %eax, %eax" + : + : "=test"("a") //~ ERROR E0662 + ); } diff --git a/src/test/ui/error-codes/E0662.stderr b/src/test/ui/error-codes/E0662.stderr index 7480f03c3d4c3..ebc5f628f2699 100644 --- a/src/test/ui/error-codes/E0662.stderr +++ b/src/test/ui/error-codes/E0662.stderr @@ -1,8 +1,8 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/E0662.rs:8:12 + --> $DIR/E0662.rs:8:17 | -LL | : "=test"("a") - | ^^^^^^^ +LL | : "=test"("a") + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0663.rs b/src/test/ui/error-codes/E0663.rs index cfbb4b37758ce..0783d705a5bfe 100644 --- a/src/test/ui/error-codes/E0663.rs +++ b/src/test/ui/error-codes/E0663.rs @@ -1,10 +1,10 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("xor %eax, %eax" - : - : "+test"("a") //~ ERROR E0663 - ); + llvm_asm!("xor %eax, %eax" + : + : "+test"("a") //~ ERROR E0663 + ); } diff --git a/src/test/ui/error-codes/E0663.stderr b/src/test/ui/error-codes/E0663.stderr index 2b7598d1577a6..4e421aa007352 100644 --- a/src/test/ui/error-codes/E0663.stderr +++ b/src/test/ui/error-codes/E0663.stderr @@ -1,8 +1,8 @@ error[E0663]: input operand constraint contains '+' - --> $DIR/E0663.rs:8:12 + --> $DIR/E0663.rs:8:17 | -LL | : "+test"("a") - | ^^^^^^^ +LL | : "+test"("a") + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0664.rs b/src/test/ui/error-codes/E0664.rs index fe70c9f96e06d..f8ca5c9c8c6de 100644 --- a/src/test/ui/error-codes/E0664.rs +++ b/src/test/ui/error-codes/E0664.rs @@ -1,11 +1,11 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("mov $$0x200, %eax" - : - : - : "{eax}" //~ ERROR E0664 - ); + llvm_asm!("mov $$0x200, %eax" + : + : + : "{eax}" //~ ERROR E0664 + ); } diff --git a/src/test/ui/error-codes/E0664.stderr b/src/test/ui/error-codes/E0664.stderr index 224fc63696a99..d0ed0f01ce79f 100644 --- a/src/test/ui/error-codes/E0664.stderr +++ b/src/test/ui/error-codes/E0664.stderr @@ -1,8 +1,8 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/E0664.rs:9:12 + --> $DIR/E0664.rs:9:17 | -LL | : "{eax}" - | ^^^^^^^ +LL | : "{eax}" + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs index 1fce279c9ef3d..7eeeb4bc4e243 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ b/src/test/ui/feature-gates/feature-gate-asm.rs @@ -3,5 +3,6 @@ fn main() { unsafe { asm!(""); //~ ERROR inline assembly is not stable enough + llvm_asm!(""); //~ ERROR inline assembly is not stable enough } } diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index 4c75d19c99fb5..1f9eaa5632e4a 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -7,6 +7,15 @@ LL | asm!(""); = note: see issue #70173 for more information = help: add `#![feature(asm)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change + --> $DIR/feature-gate-asm.rs:6:9 + | +LL | llvm_asm!(""); + | ^^^^^^^^ + | + = note: see issue #70173 for more information + = help: add `#![feature(llvm_asm)]` to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs index 4f56aa7234464..666a4894f6275 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ b/src/test/ui/feature-gates/feature-gate-asm2.rs @@ -3,5 +3,6 @@ fn main() { unsafe { println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable + println!("{:?}", llvm_asm!("")); //~ ERROR inline assembly is not stable } } diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index eaf3aa402e3b8..17ba66e9842fa 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -7,6 +7,15 @@ LL | println!("{:?}", asm!("")); = note: see issue #70173 for more information = help: add `#![feature(asm)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change + --> $DIR/feature-gate-asm2.rs:6:26 + | +LL | println!("{:?}", llvm_asm!("")); + | ^^^^^^^^ + | + = note: see issue #70173 for more information + = help: add `#![feature(llvm_asm)]` to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/inline-asm-bad-constraint.rs b/src/test/ui/inline-asm-bad-constraint.rs index 04fd5760cf8ce..edf2c2e3180e8 100644 --- a/src/test/ui/inline-asm-bad-constraint.rs +++ b/src/test/ui/inline-asm-bad-constraint.rs @@ -3,7 +3,7 @@ // build-fail // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] extern "C" { fn foo(a: usize); @@ -19,7 +19,7 @@ fn main() { fn bad_register_constraint() { let rax: u64; unsafe { - asm!("" :"={rax"(rax)) //~ ERROR E0668 + llvm_asm!("" :"={rax"(rax)) //~ ERROR E0668 }; println!("Accumulator is: {}", rax); } @@ -27,14 +27,14 @@ fn bad_register_constraint() { // Issue #54376 fn bad_input() { unsafe { - asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 + llvm_asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 }; } fn wrong_size_output() { let rax: u64 = 0; unsafe { - asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 + llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 } println!("rax: {}", rax); } diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 2647e337b9d53..d6a3b6e8382f4 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,24 +1,24 @@ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:22:9 | -LL | asm!("" :"={rax"(rax)) - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("" :"={rax"(rax)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:30:9 | -LL | asm!("callq $0" : : "0"(foo)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("callq $0" : : "0"(foo)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:37:9 | -LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/inline-asm-bad-operand.rs b/src/test/ui/inline-asm-bad-operand.rs index f4e9922164f03..e5fc4ee010678 100644 --- a/src/test/ui/inline-asm-bad-operand.rs +++ b/src/test/ui/inline-asm-bad-operand.rs @@ -4,7 +4,7 @@ // build-fail // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] #[repr(C)] struct MyPtr(usize); @@ -19,41 +19,41 @@ fn main() { fn issue_37433() { unsafe { - asm!("" :: "r"("")); //~ ERROR E0669 + llvm_asm!("" :: "r"("")); //~ ERROR E0669 } unsafe { let target = MyPtr(0); - asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 + llvm_asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 } } fn issue_37437() { let hello: &str = "hello"; // this should fail... - unsafe { asm!("" :: "i"(hello)) }; //~ ERROR E0669 + unsafe { llvm_asm!("" :: "i"(hello)) }; //~ ERROR E0669 // but this should succeed. - unsafe { asm!("" :: "r"(hello.as_ptr())) }; + unsafe { llvm_asm!("" :: "r"(hello.as_ptr())) }; } fn issue_40187() { let arr: [u8; 1] = [0; 1]; unsafe { - asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 + llvm_asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 } } fn issue_54067() { let addr: Option = Some(123); unsafe { - asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 + llvm_asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 } } fn multiple_errors() { let addr: (u32, u32) = (1, 2); unsafe { - asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 - "r"("hello e0669")); //~ ERROR E0669 + llvm_asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 + "r"("hello e0669")); //~ ERROR E0669 } } diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index fe6c6c9914199..1ac7024ec8bf0 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,41 +1,41 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:22:24 + --> $DIR/inline-asm-bad-operand.rs:22:29 | -LL | asm!("" :: "r"("")); - | ^^ +LL | llvm_asm!("" :: "r"("")); + | ^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:27:32 + --> $DIR/inline-asm-bad-operand.rs:27:37 | -LL | asm!("ret" : : "{rdi}"(target)); - | ^^^^^^ +LL | llvm_asm!("ret" : : "{rdi}"(target)); + | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:34:29 + --> $DIR/inline-asm-bad-operand.rs:34:34 | -LL | unsafe { asm!("" :: "i"(hello)) }; - | ^^^^^ +LL | unsafe { llvm_asm!("" :: "i"(hello)) }; + | ^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:42:38 + --> $DIR/inline-asm-bad-operand.rs:42:43 | -LL | asm!("movups $1, %xmm0"::"m"(arr)); - | ^^^ +LL | llvm_asm!("movups $1, %xmm0"::"m"(arr)); + | ^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:49:32 + --> $DIR/inline-asm-bad-operand.rs:49:37 | -LL | asm!("mov sp, $0"::"r"(addr)); - | ^^^^ +LL | llvm_asm!("mov sp, $0"::"r"(addr)); + | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:56:32 + --> $DIR/inline-asm-bad-operand.rs:56:37 | -LL | asm!("mov sp, $0"::"r"(addr), - | ^^^^ +LL | llvm_asm!("mov sp, $0"::"r"(addr), + | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:57:32 + --> $DIR/inline-asm-bad-operand.rs:57:37 | LL | ... "r"("hello e0669")); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-14936.rs b/src/test/ui/issues/issue-14936.rs index 33532855fcd7e..02095a2f7e4d2 100644 --- a/src/test/ui/issues/issue-14936.rs +++ b/src/test/ui/issues/issue-14936.rs @@ -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"]; diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs index 521db37170ab5..423b19c3ebd09 100644 --- a/src/test/ui/issues/issue-23458.rs +++ b/src/test/ui/issues/issue-23458.rs @@ -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 } } diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr index 76c3e6da82ea2..81f06e6397542 100644 --- a/src/test/ui/issues/issue-23458.stderr +++ b/src/test/ui/issues/issue-23458.stderr @@ -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: :1:2: error: too few operands for instruction int @@ -10,8 +10,8 @@ error: :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 diff --git a/src/test/ui/issues/issue-33264.rs b/src/test/ui/issues/issue-33264.rs index 31638b004391f..32a36e44aa1ae 100644 --- a/src/test/ui/issues/issue-33264.rs +++ b/src/test/ui/issues/issue-33264.rs @@ -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 } } diff --git a/src/test/ui/issues/issue-37366.rs b/src/test/ui/issues/issue-37366.rs index 6bf3a276ce138..be9b4af8fbc41 100644 --- a/src/test/ui/issues/issue-37366.rs +++ b/src/test/ui/issues/issue-37366.rs @@ -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"); } } } diff --git a/src/test/ui/issues/issue-37433.rs b/src/test/ui/issues/issue-37433.rs index c4d427f3ad3af..2ea970327f06b 100644 --- a/src/test/ui/issues/issue-37433.rs +++ b/src/test/ui/issues/issue-37433.rs @@ -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 } } diff --git a/src/test/ui/issues/issue-37433.stderr b/src/test/ui/issues/issue-37433.stderr index d9e1c98e9ee41..ff6965ad353b2 100644 --- a/src/test/ui/issues/issue-37433.stderr +++ b/src/test/ui/issues/issue-37433.stderr @@ -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 diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs index d911ac5efbe03..38591b0a9f84e 100644 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs +++ b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs @@ -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] diff --git a/src/test/ui/issues/issue-9129.rs b/src/test/ui/issues/issue-9129.rs index 3d87e1c203783..9a0376ad51f75 100644 --- a/src/test/ui/issues/issue-9129.rs +++ b/src/test/ui/issues/issue-9129.rs @@ -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 { diff --git a/src/test/ui/macros/macro-expanded-include/foo/mod.rs b/src/test/ui/macros/macro-expanded-include/foo/mod.rs index a8bfa0299f66f..f0eb92b2be820 100644 --- a/src/test/ui/macros/macro-expanded-include/foo/mod.rs +++ b/src/test/ui/macros/macro-expanded-include/foo/mod.rs @@ -5,5 +5,5 @@ macro_rules! m { } macro_rules! n { - () => { unsafe { asm!(include_str!("file.txt")); } } + () => { unsafe { llvm_asm!(include_str!("file.txt")); } } } diff --git a/src/test/ui/macros/macro-expanded-include/test.rs b/src/test/ui/macros/macro-expanded-include/test.rs index b8eb854b0b0f1..abf83a5c6ffd3 100644 --- a/src/test/ui/macros/macro-expanded-include/test.rs +++ b/src/test/ui/macros/macro-expanded-include/test.rs @@ -1,6 +1,6 @@ -// ignore-emscripten no asm! support +// ignore-emscripten no llvm_asm! support // build-pass (FIXME(62277): could be check-pass?) -#![feature(asm)] +#![feature(llvm_asm)] #![allow(unused)] #[macro_use] diff --git a/src/test/ui/macros/macros-nonfatal-errors.rs b/src/test/ui/macros/macros-nonfatal-errors.rs index 1eb82a20729ca..cc96a5bff522f 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.rs +++ b/src/test/ui/macros/macros-nonfatal-errors.rs @@ -3,14 +3,14 @@ // test that errors in a (selection) of macros don't kill compilation // immediately, so that we get more errors listed at a time. -#![feature(asm)] +#![feature(llvm_asm)] #![feature(trace_macros, concat_idents)] #[derive(Default)] //~ ERROR enum OrDeriveThis {} fn main() { - asm!(invalid); //~ ERROR + llvm_asm!(invalid); //~ ERROR concat_idents!("not", "idents"); //~ ERROR diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr index 1ab6b79a61ecb..f416c70123c66 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.stderr +++ b/src/test/ui/macros/macros-nonfatal-errors.stderr @@ -7,10 +7,10 @@ LL | #[derive(Default)] = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: inline assembly must be a string literal - --> $DIR/macros-nonfatal-errors.rs:13:10 + --> $DIR/macros-nonfatal-errors.rs:13:15 | -LL | asm!(invalid); - | ^^^^^^^ +LL | llvm_asm!(invalid); + | ^^^^^^^ error: concat_idents! requires ident args. --> $DIR/macros-nonfatal-errors.rs:15:5 diff --git a/src/test/ui/out-of-stack.rs b/src/test/ui/out-of-stack.rs index 5e9265be4b982..d04b0c1a6303e 100644 --- a/src/test/ui/out-of-stack.rs +++ b/src/test/ui/out-of-stack.rs @@ -8,7 +8,7 @@ // ignore-emscripten no processes // ignore-sgx no processes -#![feature(asm)] +#![feature(llvm_asm)] #![feature(rustc_private)] #[cfg(unix)] @@ -22,7 +22,7 @@ use std::thread; // Inlining to avoid llvm turning the recursive functions into tail calls, // which doesn't consume stack. #[inline(always)] -pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } +pub fn black_box(dummy: T) { unsafe { llvm_asm!("" : : "r"(&dummy)) } } fn silent_recurse() { let buf = [0u8; 1000];