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.
This commit is contained in:
Amanieu d'Antras 2022-11-02 18:47:58 +00:00
parent c0a7612728
commit 03e4c76dcf
2 changed files with 70 additions and 3 deletions

View file

@ -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);
}