about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/tests/run/asm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests/run/asm.rs')
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/asm.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_gcc/tests/run/asm.rs b/compiler/rustc_codegen_gcc/tests/run/asm.rs
index 507b65ca049..56f2aac3d0a 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");
     }
@@ -173,3 +177,11 @@ fn main() {
     }
     assert_eq!(array1, array2);
 }
+
+#[cfg(not(target_arch="x86_64"))]
+fn asm() {
+}
+
+fn main() {
+    asm();
+}