Skip to content

Commit c092ef0

Browse files
Rollup merge of #163214 - malezjaa:revert-r14-register-name, r=folkertdev
revert r14 register names for arm Fixes #163173 r? @folkertdev
2 parents 90e3ba3 + b7dc072 commit c092ef0

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

‎compiler/rustc_codegen_llvm/src/asm.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,12 +791,10 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
791791
} else if let Some(idx) = hexagon_vreg_pair_index(reg) {
792792
// LLVM uses `wN` for Hexagon HVX vector pair registers.
793793
format!("{{w{}}}", idx)
794-
} else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14)
795-
&& llvm_util::get_version() < (23, 0, 0)
796-
{
794+
} else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14) {
797795
// FIXME(llvm): LLVM <23 does not recognize `r14` as a register name
798796
// in inline assembly.
799-
// This workaround can be removed when support for LLVM 22 is dropped.
797+
// We can make this branch fallthrough again for LLVM 23+ when https://github.com/llvm/llvm-project/pull/225746 gets released.
800798
"{lr}".to_string()
801799
} else if let InlineAsmReg::Sparc(reg) = reg
802800
&& let Some(num) = reg.dreg_number()

‎tests/codegen-llvm/asm-arm-r14.rs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//@ add-minicore
22
//@ compile-flags: --target armv7-unknown-linux-gnueabihf
33
//@ needs-llvm-components: arm
4-
//@ revisions: LLVM22 LLVM23
5-
//@ [LLVM22] max-llvm-major-version: 22
6-
//@ [LLVM23] min-llvm-version: 23
74

85
#![feature(no_core)]
96
#![no_core]
@@ -15,8 +12,7 @@ use minicore::*;
1512
#[no_mangle]
1613
pub unsafe fn r14_output() -> u32 {
1714
// CHECK-LABEL: define{{.*}}@r14_output
18-
// LLVM22: asm sideeffect{{.*}}"=&{lr},~{cc},~{memory}"
19-
// LLVM23: asm sideeffect{{.*}}"=&{r14},~{cc},~{memory}"
15+
// CHECK: asm sideeffect{{.*}}"=&{lr},~{cc},~{memory}"
2016
let output: u32;
2117
asm!("", out("r14") output);
2218
output
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ add-minicore
2+
//@ build-pass
3+
//@ compile-flags: --target thumbv6m-none-eabi
4+
//@ needs-llvm-components: arm
5+
//@ ignore-backends: gcc
6+
7+
#![feature(no_core)]
8+
#![no_core]
9+
#![crate_type = "rlib"]
10+
11+
extern crate minicore;
12+
use minicore::*;
13+
14+
pub fn clobber_c_abi() {
15+
unsafe {
16+
asm!("nop", clobber_abi("C"));
17+
}
18+
}

0 commit comments

Comments
 (0)