Rollup merge of #128570 - folkertdev:stabilize-asm-const, r=Amanieu
Stabilize `asm_const` tracking issue: https://github.com/rust-lang/rust/issues/93332 reference PR: https://github.com/rust-lang/reference/pull/1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`
This commit is contained in:
commit
196d256b20
43 changed files with 294 additions and 385 deletions
|
@ -3,12 +3,10 @@
|
|||
// Run-time:
|
||||
// status: 0
|
||||
|
||||
#![feature(asm_const)]
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
global_asm!(
|
||||
"
|
||||
.global add_asm
|
||||
|
@ -22,7 +20,7 @@ extern "C" {
|
|||
fn add_asm(a: i64, b: i64) -> i64;
|
||||
}
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
|
||||
asm!(
|
||||
"rep movsb",
|
||||
|
@ -33,7 +31,7 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn asm() {
|
||||
unsafe {
|
||||
asm!("nop");
|
||||
|
@ -178,9 +176,8 @@ fn asm() {
|
|||
assert_eq!(array1, array2);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch="x86_64"))]
|
||||
fn asm() {
|
||||
}
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
fn asm() {}
|
||||
|
||||
fn main() {
|
||||
asm();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue