about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFolkert <folkert@folkertdev.nl>2024-07-18 17:13:47 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2024-09-21 13:05:23 +0200
commita41c209ef30508d58a25dcfe39fb7c7f5f3bf6a2 (patch)
tree2a0f1476edafd1039a981aa4c00a0eeff1dc8ebf
parenta33dcb3607ee763616f374eeaa84ddaf41d41ef4 (diff)
downloadrust-a41c209ef30508d58a25dcfe39fb7c7f5f3bf6a2.tar.gz
rust-a41c209ef30508d58a25dcfe39fb7c7f5f3bf6a2.zip
Add assembly test for the cmse unstable features
verifies that the correct return instructions are emitted.

Co-authored-by: Tamme Dittrich <tamme@tweedegolf.com>
-rw-r--r--tests/assembly/cmse.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/assembly/cmse.rs b/tests/assembly/cmse.rs
new file mode 100644
index 00000000000..acad77b2513
--- /dev/null
+++ b/tests/assembly/cmse.rs
@@ -0,0 +1,26 @@
+//@ assembly-output: emit-asm
+//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -Copt-level=1
+//@ needs-llvm-components: arm
+#![crate_type = "lib"]
+#![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)]
+#![no_core]
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy {}
+
+// CHECK-LABEL: __acle_se_entry_point
+// CHECK: bxns
+#[no_mangle]
+pub extern "C-cmse-nonsecure-entry" fn entry_point() -> i64 {
+    0
+}
+
+// CHECK-LABEL: call_nonsecure
+// CHECK: blxns
+#[no_mangle]
+pub fn call_nonsecure(
+    f: unsafe extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32) -> u64,
+) -> u64 {
+    unsafe { f(0, 1, 2, 3) }
+}