Arm has introduced Custom Datapath Extensions in the armv8 architecture.
The support for CDE was introduce in LLVM 11 [ARM] Release notes for the Custom Datapath Extension (CDE).
These are assembly instructions the founder of a device can use to implement some special operations like using a coprocessor.
In order to use then in C one would include the Arm header file "arm_cde.h" which defines some CDE intrinsics like this one:
uint32_t __arm_cx3(int coproc, uint32_t n, uint32_t m, uint32_t imm);
Using this will generate assembly code like this:
CX3 p1, r0, r0, r3, #8
I searched in the experimental core::arch::arm but the CDE instructions don't seem to be supported there.
I tried to use use inline assembly like this:
let result: u32;
unsafe {
core::arch::asm!("cx3 p1, {}, {}, {}, #8", out(reg) result, in(reg) a, in(reg) b);
}
As one could expect the compiler doesn't like it. Here is the error:
error: invalid instruction
|
note: instantiated into assembly here
--> <inline asm>:1:2
|
1 | cx3 p1, r0, r1, r2, #8
| ^
Do you know if it is possible to use CDE in Rust? if Yes how do I use it?
If it is currently not possible, what would be the steps to add support for CDE in the Rust compiler?
Would core::arch::arm be the right place to add these?