Skip to content

Commit

Permalink
Rollup merge of #75781 - Amanieu:asm-fix, r=nagisa
Browse files Browse the repository at this point in the history
More inline asm register name fixups for LLVM

Fixes #75761

r? @nagisa
  • Loading branch information
Dylan-DPC authored Aug 22, 2020
2 parents d826229 + 4fe4c3b commit cb9ef09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librustc_codegen_llvm/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,13 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'tcx>>)
_ => unreachable!(),
}
} else {
// We use i32 as the type for discarded outputs
's'
// We use i64x2 as the type for discarded outputs
'q'
};
format!("{{{}{}}}", class, idx)
} else if reg == InlineAsmReg::AArch64(AArch64InlineAsmReg::x30) {
// LLVM doesn't recognize x30
"lr".to_string()
} else {
format!("{{{}}}", reg.name())
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/assembly/asm/aarch64-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,8 @@ 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 cb9ef09

Please sign in to comment.