better asm loop

This commit is contained in:
2018-01-02 22:51:10 +01:00
parent 5cbc9fa6dd
commit a3df4d79e1
2 changed files with 4 additions and 17 deletions
+3 -4
View File
@@ -26,15 +26,14 @@ static inline bool isDynAlloc(const void *obj)
/** Tight asm loop */
#define __asm_loop(cycles) \
do { \
register uint32_t _count = cycles; \
register uint32_t _count asm ("r4") = cycles; \
asm volatile( \
".syntax unified\n" \
".thumb\n" \
"ldr r4, =%0\n" \
"0:" \
"subs r4, #1\n" \
"subs %0, #1\n" \
"bne 0b\n" \
: /* no outputs */ : "g" (cycles) : "r4"); \
: "+r" (_count)); \
} while(0)
#endif //GEX_CORTEX_UTILS_H