I'd like to clean up my assembly code and povide a way to call "NOP" multiple times through a macro:
#define NOP() asm(" nop")
#define NOP_N( N ) \
NOP(); \
NOP(); \
.... call NOP() N times
I can't figure if this is possible in a macro.
Obviously, for performance reasons, I don't want something like this:
#define NOP_N( n ) { register int i; for(i=0;i<n;i++) asm(" nop"); }
Which defeats the purpose of NOP:
L17: ; NOP_N(3);
nop
addi 1,r0 ; Unsigned
cmpi 3,r0
blo L17
The code is in C and assembly, so no C++ can be involved in here. Also, the compiler is fairly old and doesn't support variadic macros...