asm!
can allocate registers (it’s right in the example on the linked page). LLVM will pick a register it isn’t using for the moment and can optimize with that information.
core::arch::asm!(
"mov x, {tmp}",
tmp = out(reg) _,
);
(I’m not completely sure reg
is the right register class here, it depends on your use case)
If you need specifically el2
for some reason:
core::arch::asm!(
"mov x, {tmp}",
tmp = out("el2") _,
)