Skip to content

Commit

Permalink
Rollup merge of #128570 - folkertdev:stabilize-asm-const, r=Amanieu
Browse files Browse the repository at this point in the history
Stabilize `asm_const`

tracking issue: rust-lang/rust#93332

reference PR: rust-lang/reference#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`
  • Loading branch information
jieyouxu authored Aug 14, 2024
2 parents 1bdeb98 + bf5d862 commit 5ea1a17
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/run/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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");
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 5ea1a17

Please sign in to comment.