summaryrefslogtreecommitdiffstats
path: root/tests/assembly
diff options
context:
space:
mode:
Diffstat (limited to 'tests/assembly')
-rw-r--r--tests/assembly/asm/global_asm.rs4
-rw-r--r--tests/assembly/asm/m68k-types.rs83
-rw-r--r--tests/assembly/is_aligned.rs1
-rw-r--r--tests/assembly/static-relocation-model.rs1
-rw-r--r--tests/assembly/strict_provenance.rs1
-rw-r--r--tests/assembly/x86_64-floating-point-clamp.rs1
-rw-r--r--tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs2
-rw-r--r--tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs17
-rw-r--r--tests/assembly/x86_64-no-jump-tables.rs1
9 files changed, 95 insertions, 16 deletions
diff --git a/tests/assembly/asm/global_asm.rs b/tests/assembly/asm/global_asm.rs
index 0b361a7ed..36f017cf9 100644
--- a/tests/assembly/asm/global_asm.rs
+++ b/tests/assembly/asm/global_asm.rs
@@ -25,9 +25,9 @@ global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
global_asm!("call {}", sym my_func);
// CHECK: lea rax, [rip + MY_STATIC]
global_asm!("lea rax, [rip + {}]", sym MY_STATIC);
-// CHECK: call _RNvCsiubXh4Yz005_10global_asm6foobar
+// CHECK: call _RNvCsddMtV7nAi4C_10global_asm6foobar
global_asm!("call {}", sym foobar);
-// CHECK: _RNvCsiubXh4Yz005_10global_asm6foobar:
+// CHECK: _RNvCsddMtV7nAi4C_10global_asm6foobar:
fn foobar() {
loop {}
}
diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly/asm/m68k-types.rs
new file mode 100644
index 000000000..0322e615a
--- /dev/null
+++ b/tests/assembly/asm/m68k-types.rs
@@ -0,0 +1,83 @@
+// assembly-output: emit-asm
+// compile-flags: --target m68k-unknown-linux-gnu
+// needs-llvm-components: m68k
+
+#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
+#![crate_type = "rlib"]
+#![no_core]
+#![allow(non_camel_case_types)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+ () => {};
+}
+#[rustc_builtin_macro]
+macro_rules! concat {
+ () => {};
+}
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+type ptr = *const u64;
+
+impl Copy for i8 {}
+impl Copy for i16 {}
+impl Copy for i32 {}
+impl Copy for i64 {}
+impl Copy for ptr {}
+
+macro_rules! check {
+ ($func:ident $ty:ident $class:ident $mov:literal) => {
+ #[no_mangle]
+ pub unsafe fn $func(x: $ty) -> $ty {
+ let y;
+ asm!(concat!($mov, " {}, {};"), out($class) y, in($class) x);
+ y
+ }
+ };
+}
+
+// CHECK-LABEL: reg_data_i8:
+// CHECK: ;APP
+// CHECK: move.b %d{{[0-9]}}, %d{{[0-9]}}
+// CHECK: ;NO_APP
+check!(reg_data_i8 i8 reg_data "move.b");
+
+// CHECK-LABEL: reg_data_i16:
+// CHECK: ;APP
+// CHECK: move.w %d{{[0-9]}}, %d{{[0-9]}}
+// CHECK: ;NO_APP
+check!(reg_data_i16 i16 reg_data "move.w");
+
+// CHECK-LABEL: reg_data_i32:
+// CHECK: ;APP
+// CHECK: move.l %d{{[0-9]}}, %d{{[0-9]}}
+// CHECK: ;NO_APP
+check!(reg_data_i32 i32 reg_data "move.l");
+
+// CHECK-LABEL: reg_addr_i16:
+// CHECK: ;APP
+// CHECK: move.w %a{{[0-9]}}, %a{{[0-9]}}
+// CHECK: ;NO_APP
+check!(reg_addr_i16 i16 reg_addr "move.w");
+
+// CHECK-LABEL: reg_addr_i32:
+// CHECK: ;APP
+// CHECK: move.l %a{{[0-9]}}, %a{{[0-9]}}
+// CHECK: ;NO_APP
+check!(reg_addr_i32 i32 reg_addr "move.l");
+
+// CHECK-LABEL: reg_i16:
+// CHECK: ;APP
+// CHECK: move.w %{{[da][0-9]}}, %{{[da][0-9]}}
+// CHECK: ;NO_APP
+check!(reg_i16 i16 reg "move.w");
+
+// CHECK-LABEL: reg_i32:
+// CHECK: ;APP
+// CHECK: move.l %{{[da][0-9]}}, %{{[da][0-9]}}
+// CHECK: ;NO_APP
+check!(reg_i32 i32 reg "move.l");
diff --git a/tests/assembly/is_aligned.rs b/tests/assembly/is_aligned.rs
index 620a3da94..148d11ee4 100644
--- a/tests/assembly/is_aligned.rs
+++ b/tests/assembly/is_aligned.rs
@@ -1,6 +1,7 @@
// assembly-output: emit-asm
// min-llvm-version: 15.0
// only-x86_64
+// ignore-sgx
// revisions: opt-speed opt-size
// [opt-speed] compile-flags: -Copt-level=1
// [opt-size] compile-flags: -Copt-level=s
diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly/static-relocation-model.rs
index faa2e3952..41aa9a461 100644
--- a/tests/assembly/static-relocation-model.rs
+++ b/tests/assembly/static-relocation-model.rs
@@ -6,6 +6,7 @@
// [A64] needs-llvm-components: aarch64
// [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static
// [ppc64le] needs-llvm-components: powerpc
+// ignore-debug: alignment checks insert panics that we don't have a lang item for
#![feature(no_core, lang_items)]
#![no_core]
diff --git a/tests/assembly/strict_provenance.rs b/tests/assembly/strict_provenance.rs
index 01f1957d5..24a7c6b5b 100644
--- a/tests/assembly/strict_provenance.rs
+++ b/tests/assembly/strict_provenance.rs
@@ -1,6 +1,7 @@
// assembly-output: emit-asm
// compile-flags: -Copt-level=1
// only-x86_64
+// ignore-sgx
// min-llvm-version: 15.0
#![crate_type = "rlib"]
diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs
index 0f3b465d0..0bc6baad4 100644
--- a/tests/assembly/x86_64-floating-point-clamp.rs
+++ b/tests/assembly/x86_64-floating-point-clamp.rs
@@ -4,6 +4,7 @@
// assembly-output: emit-asm
// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
// only-x86_64
+// ignore-sgx
// CHECK-LABEL: clamp_demo:
#[no_mangle]
diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
index 79d82cf70..7eb3c6948 100644
--- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
+++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
@@ -11,7 +11,7 @@ pub extern fn plus_one(r: &mut u64) {
// CHECK: plus_one
// CHECK: lfence
-// CHECK-NEXT: addq
+// CHECK-NEXT: incq
// CHECK: popq [[REGISTER:%[a-z]+]]
// CHECK-NEXT: lfence
// CHECK-NEXT: jmpq *[[REGISTER]]
diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs
index c316379d5..4745ebc4f 100644
--- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs
+++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs
@@ -10,9 +10,7 @@ use std::arch::asm;
pub extern "C" fn get(ptr: *const u64) -> u64 {
let value: u64;
unsafe {
- asm!(".start_inline_asm:",
- "mov {}, [{}]",
- ".end_inline_asm:",
+ asm!("mov {}, [{}]",
out(reg) value,
in(reg) ptr);
}
@@ -20,24 +18,17 @@ pub extern "C" fn get(ptr: *const u64) -> u64 {
}
// CHECK: get
-// CHECK: .start_inline_asm
-// CHECK-NEXT: movq
+// CHECK: movq
// CHECK-NEXT: lfence
-// CHECK-NEXT: .end_inline_asm
#[no_mangle]
pub extern "C" fn myret() {
unsafe {
- asm!(
- ".start_myret_inline_asm:",
- "ret",
- ".end_myret_inline_asm:",
- );
+ asm!("ret");
}
}
// CHECK: myret
-// CHECK: .start_myret_inline_asm
-// CHECK-NEXT: shlq $0, (%rsp)
+// CHECK: shlq $0, (%rsp)
// CHECK-NEXT: lfence
// CHECK-NEXT: retq
diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs
index 007c3591a..edf4adaad 100644
--- a/tests/assembly/x86_64-no-jump-tables.rs
+++ b/tests/assembly/x86_64-no-jump-tables.rs
@@ -6,6 +6,7 @@
// compile-flags: -O
// [set] compile-flags: -Zno-jump-tables
// only-x86_64
+// ignore-sgx
#![crate_type = "lib"]