From 03e4c76dcffc35c660bbea602993828328fda7b2 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Wed, 2 Nov 2022 18:47:58 +0000 Subject: 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. --- src/test/ui/asm/aarch64/llvm-58384.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/ui/asm/aarch64/llvm-58384.rs (limited to 'src') 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); +} -- cgit 1.4.1-3-g733a5