loongArch64/asm.rs
1//! Assembly instructions
2
3macro_rules! instruction {
4 ($(#[$attr:meta])*, $fnname:ident, $asm:expr) => (
5 $(#[$attr])*
6 #[inline]
7 pub unsafe fn $fnname() {
8 match () {
9 #[cfg(target_arch = "loongarch64")]
10 () => core::arch::asm!($asm),
11
12 #[cfg(not(target_arch = "loongarch64"))]
13 () => unimplemented!(),
14 }
15 }
16 )
17}
18
19instruction!(
20 /// `nop` instruction wrapper
21 ///
22 /// Generates a no-operation. Useful to prevent delay loops from being optimized away.
23 , nop, "nop");
24instruction!(
25 /// `EBREAK` instruction wrapper
26 ///
27 /// Generates a breakpoint exception.
28 , r#break, "break");
29instruction!(
30 /// `EBREAK` instruction wrapper
31 ///
32 /// The format is `idle level`. What is level is still unknown. Temporarily use `1` as `level`.
33 , idle, "idle 1");