summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-07-20 08:18:04 +0000
committerNils Wallménius <nils@rockbox.org>2010-07-20 08:18:04 +0000
commitf32294d6abff7c5952b3a0c079a54b53eb42eb40 (patch)
tree54a0bff738a41dabec9fe792b33b2279ddde4d89
parentbd78dc7693743e35a854d3a615a20474a7a450b2 (diff)
downloadrockbox-f32294d6abff7c5952b3a0c079a54b53eb42eb40.tar.gz
rockbox-f32294d6abff7c5952b3a0c079a54b53eb42eb40.zip
Shorten: tweak some inline asm, use local lables to not cause problems when the function gets inlined, mark it as inline, tweak clobbers and use lea instead of add in one place. Fixes problems when building libffmpegFLAC with newer gcc.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27503 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/libffmpegFLAC/shndec.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/apps/codecs/libffmpegFLAC/shndec.c b/apps/codecs/libffmpegFLAC/shndec.c
index b107b356d7..78914f6252 100644
--- a/apps/codecs/libffmpegFLAC/shndec.c
+++ b/apps/codecs/libffmpegFLAC/shndec.c
@@ -73,8 +73,7 @@ static unsigned int get_uint(ShortenContext *s, int k)
73} 73}
74 74
75#if defined(CPU_COLDFIRE) 75#if defined(CPU_COLDFIRE)
76static void coldfire_lshift_samples(int n, int shift, int32_t *samples) ICODE_ATTR_FLAC; 76static inline void coldfire_lshift_samples(int n, int shift, int32_t *samples)
77static void coldfire_lshift_samples(int n, int shift, int32_t *samples)
78{ 77{
79/* 78/*
80 for (i = 0; i < n; i++) 79 for (i = 0; i < n; i++)
@@ -83,34 +82,33 @@ static void coldfire_lshift_samples(int n, int shift, int32_t *samples)
83 asm volatile ( 82 asm volatile (
84 "move.l %[n], %%d0 \n" /* d0 = loop counter */ 83 "move.l %[n], %%d0 \n" /* d0 = loop counter */
85 "asr.l #2, %%d0 \n" 84 "asr.l #2, %%d0 \n"
86 "beq l1_shift \n" 85 "beq 1f \n"
87 "l2_shift:" /* main loop (unroll by 4) */ 86 "2:" /* main loop (unroll by 4) */
88 "movem.l (%[x]), %%d4-%%d7 \n" 87 "movem.l (%[x]), %%d4-%%d7 \n"
89 "asl.l %[s], %%d4 \n" 88 "asl.l %[s], %%d4 \n"
90 "asl.l %[s], %%d5 \n" 89 "asl.l %[s], %%d5 \n"
91 "asl.l %[s], %%d6 \n" 90 "asl.l %[s], %%d6 \n"
92 "asl.l %[s], %%d7 \n" 91 "asl.l %[s], %%d7 \n"
93 "movem.l %%d4-%%d7, (%[x]) \n" 92 "movem.l %%d4-%%d7, (%[x]) \n"
94 "add.l #16, %[x] \n" 93 "lea.l (16, %[x]), %[x] \n"
95 94
96 "subq.l #1, %%d0 \n" 95 "subq.l #1, %%d0 \n"
97 "bne l2_shift \n" 96 "bne 2b \n"
98 "l1_shift:" /* any loops left? */ 97 "1:" /* any loops left? */
99 "and.l #3, %[n] \n" 98 "and.l #3, %[n] \n"
100 "beq l4_shift \n" 99 "beq 4f \n"
101 "l3_shift:" /* remaining loops */ 100 "3:" /* remaining loops */
102 "move.l (%[x]), %%d4 \n" 101 "move.l (%[x]), %%d4 \n"
103 "asl.l %[s], %%d4 \n" 102 "asl.l %[s], %%d4 \n"
104 "move.l %%d4, (%[x])+ \n" 103 "move.l %%d4, (%[x])+ \n"
105 104
106 "subq.l #1, %[n] \n" 105 "subq.l #1, %[n] \n"
107 "bne l3_shift \n" 106 "bne 3b \n"
108 "l4_shift:" /* exit */ 107 "4:" /* exit */
109 : [n] "+d" (n), /* d1 */ 108 : [n] "+d" (n),
110 [s] "+d" (shift), /* d2 */ 109 [x] "+a" (samples)
111 [x] "+a" (samples) /* a0 */ 110 : [s] "d" (shift)
112 : 111 : "%d0", "%d4", "%d5", "%d6", "%d7", "cc", "memory"
113 : "%d0", "%d4", "%d5", "%d6", "%d7"
114 ); 112 );
115} 113}
116#endif 114#endif