1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Nils Wallménius 2010-07-20 08:18:04 +00:00
parent bd78dc7693
commit f32294d6ab

View file

@ -73,8 +73,7 @@ static unsigned int get_uint(ShortenContext *s, int k)
}
#if defined(CPU_COLDFIRE)
static void coldfire_lshift_samples(int n, int shift, int32_t *samples) ICODE_ATTR_FLAC;
static void coldfire_lshift_samples(int n, int shift, int32_t *samples)
static inline void coldfire_lshift_samples(int n, int shift, int32_t *samples)
{
/*
for (i = 0; i < n; i++)
@ -83,34 +82,33 @@ static void coldfire_lshift_samples(int n, int shift, int32_t *samples)
asm volatile (
"move.l %[n], %%d0 \n" /* d0 = loop counter */
"asr.l #2, %%d0 \n"
"beq l1_shift \n"
"l2_shift:" /* main loop (unroll by 4) */
"beq 1f \n"
"2:" /* main loop (unroll by 4) */
"movem.l (%[x]), %%d4-%%d7 \n"
"asl.l %[s], %%d4 \n"
"asl.l %[s], %%d5 \n"
"asl.l %[s], %%d6 \n"
"asl.l %[s], %%d7 \n"
"movem.l %%d4-%%d7, (%[x]) \n"
"add.l #16, %[x] \n"
"lea.l (16, %[x]), %[x] \n"
"subq.l #1, %%d0 \n"
"bne l2_shift \n"
"l1_shift:" /* any loops left? */
"bne 2b \n"
"1:" /* any loops left? */
"and.l #3, %[n] \n"
"beq l4_shift \n"
"l3_shift:" /* remaining loops */
"beq 4f \n"
"3:" /* remaining loops */
"move.l (%[x]), %%d4 \n"
"asl.l %[s], %%d4 \n"
"move.l %%d4, (%[x])+ \n"
"subq.l #1, %[n] \n"
"bne l3_shift \n"
"l4_shift:" /* exit */
: [n] "+d" (n), /* d1 */
[s] "+d" (shift), /* d2 */
[x] "+a" (samples) /* a0 */
:
: "%d0", "%d4", "%d5", "%d6", "%d7"
"bne 3b \n"
"4:" /* exit */
: [n] "+d" (n),
[x] "+a" (samples)
: [s] "d" (shift)
: "%d0", "%d4", "%d5", "%d6", "%d7", "cc", "memory"
);
}
#endif