Replacing the x86 rep Assembly Instruction
Symptom
Error: unknown mnemonic 'rep' -- 'rep'
Possible Cause
rep is an x86 instruction used to repeat an execution. It needs to be replaced with the rept instruction of the ARM64.
Procedure
Modify the code as follows:
- Example code on the x86 platform:
#define nop __asm__ __volatile__("rep;nop": : :"memory") - The following is a code example on the Kunpeng platform. In this example, an empty instruction is implemented, and the parameter n indicates the number of cycles.
#define __nops(n) ".rept " #n "\nnop\n.endr\n"
#define nops(n) asm volatile(__nops(n))
Parent topic: Embedded Assemblies