1
Fork 0

Merge commit 'e4fe941b11' into subtree-update_cg_gcc_2023-10-25

This commit is contained in:
Antoni Boucher 2023-10-26 17:42:02 -04:00
commit c797cccda6
47 changed files with 2659 additions and 502 deletions

View file

@ -5,8 +5,10 @@
#![feature(asm_const)]
#[cfg(target_arch="x86_64")]
use std::arch::{asm, global_asm};
#[cfg(target_arch="x86_64")]
global_asm!(
"
.global add_asm
@ -20,6 +22,7 @@ extern "C" {
fn add_asm(a: i64, b: i64) -> i64;
}
#[cfg(target_arch="x86_64")]
pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
asm!(
"rep movsb",
@ -30,7 +33,8 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
);
}
fn main() {
#[cfg(target_arch="x86_64")]
fn asm() {
unsafe {
asm!("nop");
}
@ -173,3 +177,11 @@ fn main() {
}
assert_eq!(array1, array2);
}
#[cfg(not(target_arch="x86_64"))]
fn asm() {
}
fn main() {
asm();
}