about summary refs log tree commit diff
path: root/tests/ui/asm
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2024-10-14 05:30:45 +0900
committerTaiki Endo <te316e89@gmail.com>2024-10-14 05:30:45 +0900
commitd858dfedbbde119f2ea707fea253e99c824ec252 (patch)
tree8297efb9c430d26187bbc45012d47f73f5dc9cc4 /tests/ui/asm
parent8f8bee4f60d9d3769f75c70d558c27a95761c554 (diff)
downloadrust-d858dfedbbde119f2ea707fea253e99c824ec252.tar.gz
rust-d858dfedbbde119f2ea707fea253e99c824ec252.zip
Fix clobber_abi and disallow SVE-related registers in Arm64EC inline assembly
Diffstat (limited to 'tests/ui/asm')
-rw-r--r--tests/ui/asm/aarch64/aarch64-sve.rs28
-rw-r--r--tests/ui/asm/aarch64/arm64ec-sve.rs31
-rw-r--r--tests/ui/asm/aarch64/arm64ec-sve.stderr14
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/ui/asm/aarch64/aarch64-sve.rs b/tests/ui/asm/aarch64/aarch64-sve.rs
new file mode 100644
index 00000000000..8cdc9dd4266
--- /dev/null
+++ b/tests/ui/asm/aarch64/aarch64-sve.rs
@@ -0,0 +1,28 @@
+//@ only-aarch64
+//@ build-pass
+//@ needs-asm-support
+
+#![crate_type = "rlib"]
+#![feature(no_core, rustc_attrs, lang_items)]
+#![no_core]
+
+// AArch64 test corresponding to arm64ec-sve.rs.
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+impl Copy for f64 {}
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {};
+}
+
+fn f(x: f64) {
+    unsafe {
+        asm!("", out("p0") _);
+        asm!("", out("ffr") _);
+    }
+}
diff --git a/tests/ui/asm/aarch64/arm64ec-sve.rs b/tests/ui/asm/aarch64/arm64ec-sve.rs
new file mode 100644
index 00000000000..389b365a754
--- /dev/null
+++ b/tests/ui/asm/aarch64/arm64ec-sve.rs
@@ -0,0 +1,31 @@
+//@ compile-flags: --target arm64ec-pc-windows-msvc
+//@ needs-asm-support
+//@ needs-llvm-components: aarch64
+
+#![crate_type = "rlib"]
+#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
+#![no_core]
+
+// SVE cannot be used for Arm64EC
+// https://github.com/rust-lang/rust/pull/131332#issuecomment-2401189142
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+impl Copy for f64 {}
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {};
+}
+
+fn f(x: f64) {
+    unsafe {
+        asm!("", out("p0") _);
+        //~^ ERROR cannot use register `p0`
+        asm!("", out("ffr") _);
+        //~^ ERROR cannot use register `ffr`
+    }
+}
diff --git a/tests/ui/asm/aarch64/arm64ec-sve.stderr b/tests/ui/asm/aarch64/arm64ec-sve.stderr
new file mode 100644
index 00000000000..3e1a5d57004
--- /dev/null
+++ b/tests/ui/asm/aarch64/arm64ec-sve.stderr
@@ -0,0 +1,14 @@
+error: cannot use register `p0`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
+  --> $DIR/arm64ec-sve.rs:26:18
+   |
+LL |         asm!("", out("p0") _);
+   |                  ^^^^^^^^^^^
+
+error: cannot use register `ffr`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
+  --> $DIR/arm64ec-sve.rs:28:18
+   |
+LL |         asm!("", out("ffr") _);
+   |                  ^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+