Closed
Description
Code
I tried this code: (with --target thumbv6m-none-eabi
)
#![no_std]
pub fn test() {
unsafe {
core::arch::asm!(
"nop",
in("r8") 1,
);
}
}
I expected to see this happen: Code compiles, resulting code should be something like:
example::test:
push {r6, r7, lr}
add r7, sp, #4
mov lr, r8
push {lr}
movs r0, #1
mov r8, r0
nop
pop {r0}
mov r8, r0
pop {r6, r7, pc}
https://godbolt.org/z/c4Y49qz7q
Instead, this happened: Compilation fails with error message:
error: cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code
--> src/lib.rs:7:13
|
7 | in("r8") 1,
| ^^^^^^^^^^
https://godbolt.org/z/b6cnG4nM3
Version it worked on
It works on both 1.62.0 and 1.63.0-beta.4, and all other stable versions I tried since asm!
got stabilized.
@Dirbaio did some bisecting and found: nightly-2021-12-09 works, nightly-2021-12-10 fails
Version with regression
I tried it with:
rustc --version --verbose
:
rustc 1.64.0-nightly (1517f5de0 2022-07-07)
binary: rustc
commit-hash: 1517f5de01c445b5124b30f02257b02b4c5ef3b2
commit-date: 2022-07-07
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
I don't have details about the versions @Dirbaio tried.