Skip to content

Commit

Permalink
Rollup merge of rust-lang#75939 - Amanieu:fix_asm2, r=nagisa
Browse files Browse the repository at this point in the history
Fix a typo in rust-lang#75781
  • Loading branch information
Dylan-DPC committed Aug 29, 2020
2 parents 9cd0768 + 9ae5e95 commit 5ee0755
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
16 changes: 11 additions & 5 deletions src/test/assembly/asm/aarch64-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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") _);
}

0 comments on commit 5ee0755

Please sign in to comment.