From 44a3a66ee890545a2c1ac78ff8f107fe5e7204f9 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 10 Dec 2021 00:15:33 +0000 Subject: Stabilize asm! and global_asm! They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros. --- src/test/codegen/asm-clobber_abi.rs | 3 ++- src/test/codegen/asm-clobbers.rs | 3 ++- src/test/codegen/asm-may_unwind.rs | 4 +++- src/test/codegen/asm-multiple-options.rs | 3 ++- src/test/codegen/asm-options.rs | 3 ++- src/test/codegen/asm-target-clobbers.rs | 3 ++- src/test/codegen/global_asm.rs | 9 ++++++--- src/test/codegen/global_asm_include.rs | 3 ++- src/test/codegen/global_asm_x2.rs | 17 +++++++++++------ src/test/codegen/naked-noinline.rs | 23 ++++++++++++----------- 10 files changed, 44 insertions(+), 27 deletions(-) (limited to 'src/test/codegen') diff --git a/src/test/codegen/asm-clobber_abi.rs b/src/test/codegen/asm-clobber_abi.rs index d589a7c6688..69e35270266 100644 --- a/src/test/codegen/asm-clobber_abi.rs +++ b/src/test/codegen/asm-clobber_abi.rs @@ -2,7 +2,8 @@ // only-x86_64 #![crate_type = "rlib"] -#![feature(asm)] + +use std::arch::asm; // CHECK-LABEL: @clobber_sysv64 // CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory} diff --git a/src/test/codegen/asm-clobbers.rs b/src/test/codegen/asm-clobbers.rs index 9d7c8b5f155..2ef10a2837d 100644 --- a/src/test/codegen/asm-clobbers.rs +++ b/src/test/codegen/asm-clobbers.rs @@ -2,7 +2,8 @@ // only-x86_64 #![crate_type = "rlib"] -#![feature(asm)] + +use std::arch::asm; // CHECK-LABEL: @x87_clobber // CHECK: ~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)} diff --git a/src/test/codegen/asm-may_unwind.rs b/src/test/codegen/asm-may_unwind.rs index 85cae8b2b1c..3b34d79c3a9 100644 --- a/src/test/codegen/asm-may_unwind.rs +++ b/src/test/codegen/asm-may_unwind.rs @@ -3,7 +3,9 @@ // only-x86_64 #![crate_type = "rlib"] -#![feature(asm, asm_unwind)] +#![feature(asm_unwind)] + +use std::arch::asm; #[no_mangle] pub extern "C" fn panicky() {} diff --git a/src/test/codegen/asm-multiple-options.rs b/src/test/codegen/asm-multiple-options.rs index baf9f3e9bd1..1ae37d627d6 100644 --- a/src/test/codegen/asm-multiple-options.rs +++ b/src/test/codegen/asm-multiple-options.rs @@ -2,7 +2,8 @@ // only-x86_64 #![crate_type = "rlib"] -#![feature(asm)] + +use std::arch::asm; // CHECK-LABEL: @pure // CHECK-NOT: asm diff --git a/src/test/codegen/asm-options.rs b/src/test/codegen/asm-options.rs index 28df0f9b852..963b60cfe35 100644 --- a/src/test/codegen/asm-options.rs +++ b/src/test/codegen/asm-options.rs @@ -2,7 +2,8 @@ // only-x86_64 #![crate_type = "rlib"] -#![feature(asm)] + +use std::arch::asm; // CHECK-LABEL: @pure // CHECK-NOT: asm diff --git a/src/test/codegen/asm-target-clobbers.rs b/src/test/codegen/asm-target-clobbers.rs index f637cdcd234..8845cfbe767 100644 --- a/src/test/codegen/asm-target-clobbers.rs +++ b/src/test/codegen/asm-target-clobbers.rs @@ -3,7 +3,8 @@ // [avx512]compile-flags: -C target-feature=+avx512f #![crate_type = "rlib"] -#![feature(asm)] + +use std::arch::asm; // CHECK-LABEL: @avx512_clobber // base: call void asm sideeffect inteldialect "", "~{xmm31}"() diff --git a/src/test/codegen/global_asm.rs b/src/test/codegen/global_asm.rs index 57d8aeb165b..fab84868fdf 100644 --- a/src/test/codegen/global_asm.rs +++ b/src/test/codegen/global_asm.rs @@ -39,18 +39,21 @@ // ignore-emscripten // compile-flags: -C no-prepopulate-passes -#![feature(global_asm)] #![crate_type = "lib"] +use std::arch::global_asm; + // CHECK-LABEL: foo // CHECK: module asm // this regex will capture the correct unconditional branch inst. // CHECK: module asm "{{[[:space:]]+}}jmp baz" -global_asm!(r#" +global_asm!( + r#" .global foo foo: jmp baz -"#); +"# +); extern "C" { fn foo(); diff --git a/src/test/codegen/global_asm_include.rs b/src/test/codegen/global_asm_include.rs index 44402619c43..02ee916458f 100644 --- a/src/test/codegen/global_asm_include.rs +++ b/src/test/codegen/global_asm_include.rs @@ -39,9 +39,10 @@ // ignore-emscripten // compile-flags: -C no-prepopulate-passes -#![feature(global_asm)] #![crate_type = "lib"] +use std::arch::global_asm; + // CHECK-LABEL: foo // CHECK: module asm // CHECK: module asm "{{[[:space:]]+}}jmp baz" diff --git a/src/test/codegen/global_asm_x2.rs b/src/test/codegen/global_asm_x2.rs index d632d0dde00..bdcf0ea843c 100644 --- a/src/test/codegen/global_asm_x2.rs +++ b/src/test/codegen/global_asm_x2.rs @@ -39,9 +39,10 @@ // ignore-emscripten // compile-flags: -C no-prepopulate-passes -#![feature(global_asm)] #![crate_type = "lib"] -#[no_std] +#![no_std] + +use core::arch::global_asm; // CHECK-LABEL: foo // CHECK: module asm @@ -49,11 +50,13 @@ // any other global_asm will be appended to this first block, so: // CHECK-LABEL: bar // CHECK: module asm "{{[[:space:]]+}}jmp quux" -global_asm!(r#" +global_asm!( + r#" .global foo foo: jmp baz -"#); +"# +); extern "C" { fn foo(); @@ -64,11 +67,13 @@ extern "C" { pub unsafe extern "C" fn baz() {} // no checks here; this has been appended to the first occurrence -global_asm!(r#" +global_asm!( + r#" .global bar bar: jmp quux -"#); +"# +); extern "C" { fn bar(); diff --git a/src/test/codegen/naked-noinline.rs b/src/test/codegen/naked-noinline.rs index d576a53826c..e34ccf5c5fe 100644 --- a/src/test/codegen/naked-noinline.rs +++ b/src/test/codegen/naked-noinline.rs @@ -3,28 +3,29 @@ // needs-asm-support // ignore-wasm32 #![crate_type = "lib"] -#![feature(asm)] #![feature(naked_functions)] +use std::arch::asm; + #[inline(always)] #[naked] #[no_mangle] pub unsafe extern "C" fn f() { -// Check that f has naked and noinline attributes. -// -// CHECK: define void @f() unnamed_addr [[ATTR:#[0-9]+]] -// CHECK-NEXT: start: -// CHECK-NEXT: call void asm + // Check that f has naked and noinline attributes. + // + // CHECK: define void @f() unnamed_addr [[ATTR:#[0-9]+]] + // CHECK-NEXT: start: + // CHECK-NEXT: call void asm asm!("", options(noreturn)); } #[no_mangle] pub unsafe fn g() { -// Check that call to f is not inlined. -// -// CHECK-LABEL: define void @g() -// CHECK-NEXT: start: -// CHECK-NEXT: call void @f() + // Check that call to f is not inlined. + // + // CHECK-LABEL: define void @g() + // CHECK-NEXT: start: + // CHECK-NEXT: call void @f() f(); } -- cgit 1.4.1-3-g733a5