summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_gcc/tests/run/asm.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /compiler/rustc_codegen_gcc/tests/run/asm.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests/run/asm.rs')
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/asm.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/tests/run/asm.rs b/compiler/rustc_codegen_gcc/tests/run/asm.rs
index 38c1eac7a..56f2aac3d 100644
--- a/compiler/rustc_codegen_gcc/tests/run/asm.rs
+++ b/compiler/rustc_codegen_gcc/tests/run/asm.rs
@@ -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");
}
@@ -124,7 +128,7 @@ fn main() {
// check const (ATT syntax)
let mut x: u64 = 42;
unsafe {
- asm!("add {}, {}",
+ asm!("add ${}, {}",
const 1,
inout(reg) x,
options(att_syntax)
@@ -173,3 +177,11 @@ fn main() {
}
assert_eq!(array1, array2);
}
+
+#[cfg(not(target_arch="x86_64"))]
+fn asm() {
+}
+
+fn main() {
+ asm();
+}