aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMichael Hope <michael.hope@linaro.org>2012-07-07 18:01:01 +1200
committerMarti Bolivar <mbolivar@leaflabs.com>2012-08-22 13:02:58 -0400
commitf168a5b936c1b4b70f73e6b18116b34d1c277480 (patch)
tree2ca9415fb871e946edb8b3c68a6b06e1ab90948b /libmaple/include
parent4c0e283c07a1a973eb29e312588986fe36b8db97 (diff)
downloadlibrambutan-f168a5b936c1b4b70f73e6b18116b34d1c277480.tar.gz
librambutan-f168a5b936c1b4b70f73e6b18116b34d1c277480.zip
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>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/delay.h8
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