From f168a5b936c1b4b70f73e6b18116b34d1c277480 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Sat, 7 Jul 2012 18:01:01 +1200 Subject: Re-work the constraints on delay_us(). Ask GCC to allocate a register instead of forcing r0. Use the same operand as input and output to remove the move. Signed-off-by: Michael Hope --- libmaple/include/libmaple/delay.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmaple/include') diff --git a/libmaple/include/libmaple/delay.h b/libmaple/include/libmaple/delay.h index 472a208..fbe7d1b 100644 --- a/libmaple/include/libmaple/delay.h +++ b/libmaple/include/libmaple/delay.h @@ -50,12 +50,12 @@ static inline void delay_us(uint32 us) { /* fudge for function call overhead */ us--; - asm volatile(" mov r0, %[us] \n\t" - "1: subs r0, #1 \n\t" + asm volatile("1: subs %[us], #1 \n\t" " bhi 1b \n\t" + : [us] "=r" (us) + : "[us]" (us) : - : [us] "r" (us) - : "r0"); + ); } #ifdef __cplusplus -- cgit v1.2.3