diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 4fef94dde5f7a..a468d09c2d93d 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -485,7 +485,7 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'tcx>>) format!("{{{}{}}}", class, idx) } else if reg == InlineAsmReg::AArch64(AArch64InlineAsmReg::x30) { // LLVM doesn't recognize x30 - "lr".to_string() + "{lr}".to_string() } else { format!("{{{}}}", reg.name()) } diff --git a/src/test/assembly/asm/aarch64-types.rs b/src/test/assembly/asm/aarch64-types.rs index e39f74c916c4a..8dd1f3c873ff5 100644 --- a/src/test/assembly/asm/aarch64-types.rs +++ b/src/test/assembly/asm/aarch64-types.rs @@ -96,6 +96,17 @@ pub unsafe fn sym_static() { asm!("adr x0, {}", sym extern_static); } +// Regression test for #75761 +// CHECK-LABEL: issue_75761: +// CHECK: str {{.*}}x30 +// CHECK: //APP +// CHECK: //NO_APP +// CHECK: ldr {{.*}}x30 +#[no_mangle] +pub unsafe fn issue_75761() { + asm!("", out("v0") _, out("x30") _); +} + macro_rules! check { ($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => { #[no_mangle] @@ -553,8 +564,3 @@ check_reg!(v0_f32x4 f32x4 "s0" "fmov"); // CHECK: fmov s0, s0 // CHECK: //NO_APP check_reg!(v0_f64x2 f64x2 "s0" "fmov"); - -// Regression test for #75761 -pub unsafe fn issue_75761() { - asm!("", out("v0") _, out("x30") _); -}