about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2022-11-02 18:47:58 +0000
committerAmanieu d'Antras <amanieu@gmail.com>2022-11-02 19:52:49 +0000
commit03e4c76dcffc35c660bbea602993828328fda7b2 (patch)
treedc7d2a362f2c9a3077865c3b5ece24a12e162981 /src/test
parentc0a76127283bc963b085f54a1b275a8e281e81e6 (diff)
downloadrust-03e4c76dcffc35c660bbea602993828328fda7b2.tar.gz
rust-03e4c76dcffc35c660bbea602993828328fda7b2.zip
asm: Work around LLVM bug on AArch64
Upstream issue: https://github.com/llvm/llvm-project/issues/58384

LLVM gets confused if we assign a 32-bit value to a 64-bit register, so
pass the 32-bit register name to LLVM in that case.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/asm/aarch64/llvm-58384.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/asm/aarch64/llvm-58384.rs b/src/test/ui/asm/aarch64/llvm-58384.rs
new file mode 100644
index 00000000000..308f7890829
--- /dev/null
+++ b/src/test/ui/asm/aarch64/llvm-58384.rs
@@ -0,0 +1,16 @@
+// only-aarch64
+// run-pass
+// needs-asm-support
+
+// Test that we properly work around this LLVM issue:
+// https://github.com/llvm/llvm-project/issues/58384
+
+use std::arch::asm;
+
+fn main() {
+    let a: i32;
+    unsafe {
+        asm!("", inout("x0") 435 => a);
+    }
+    assert_eq!(a, 435);
+}