1 #ifndef _SELFTESTS_POWERPC_INSTRUCTIONS_H
2 #define _SELFTESTS_POWERPC_INSTRUCTIONS_H
7 /* This defines the "copy" instruction from Power ISA 3.0 Book II, section 4.4. */
8 #define __COPY(RA, RB, L) \
9 (0x7c00060c | (RA) << (31-15) | (RB) << (31-20) | (L) << (31-10))
10 #define COPY(RA, RB, L) \
11 .long __COPY((RA), (RB), (L))
13 static inline void copy(void *i)
15 asm volatile(str(COPY(0, %0, 0))";"
22 static inline void copy_first(void *i)
24 asm volatile(str(COPY(0, %0, 1))";"
31 /* This defines the "paste" instruction from Power ISA 3.0 Book II, section 4.4. */
32 #define __PASTE(RA, RB, L, RC) \
33 (0x7c00070c | (RA) << (31-15) | (RB) << (31-20) | (L) << (31-10) | (RC) << (31-31))
34 #define PASTE(RA, RB, L, RC) \
35 .long __PASTE((RA), (RB), (L), (RC))
37 static inline int paste(void *i)
41 asm volatile(str(PASTE(0, %1, 0, 0))";"
50 static inline int paste_last(void *i)
54 asm volatile(str(PASTE(0, %1, 1, 1))";"
63 #define PPC_INST_COPY __COPY(0, 0, 0)
64 #define PPC_INST_COPY_FIRST __COPY(0, 0, 1)
65 #define PPC_INST_PASTE __PASTE(0, 0, 0, 0)
66 #define PPC_INST_PASTE_LAST __PASTE(0, 0, 1, 1)
68 #endif /* _SELFTESTS_POWERPC_INSTRUCTIONS_H */