diff options
| author | Michael Hope <michael.hope@linaro.org> | 2012-07-07 18:01:01 +1200 |
|---|---|---|
| committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-08-22 13:02:58 -0400 |
| commit | 715a63dccb3a39d7d0502fb39b900c8302a60a87 (patch) | |
| tree | 2ca9415fb871e946edb8b3c68a6b06e1ab90948b | |
| parent | 10a1763caab36c17a3fefb433812aea3aeceb428 (diff) | |
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 <michael.hope@linaro.org>
| -rw-r--r-- | libmaple/include/libmaple/delay.h | 8 |
1 files changed, 4 insertions, 4 deletions
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 |
