From 58384f03fb0c46eb642d7a8af9c32c0ecd91ad25 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Wed, 28 Sep 2005 17:36:42 +0000 Subject: iRiver: Make it possible to build Rockbox using GCC 4.0.1. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7569 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libmad/synth.c | 36 +++++++++++++++++++++++++++++++++++- apps/plugins/rockboy/rockboy.c | 7 +++++++ apps/plugins/rockboy/rockmacros.h | 3 ++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/apps/codecs/libmad/synth.c b/apps/codecs/libmad/synth.c index 4315e239e8..1b13312caf 100644 --- a/apps/codecs/libmad/synth.c +++ b/apps/codecs/libmad/synth.c @@ -643,6 +643,40 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, ++Dptr; /* D[32 - sb][i] == -D[sb][31 - i] */ +#if __GNUC__ >= 4 + /* GCC 4.0.1 can't find a suitable register here if all of d0-d7 + * are clobbered, so use fewer registers. It does mean two extra + * movem instructions, but should have no additional performance + * impact (like not being able to use burst mode for the movem). + */ + asm volatile ( + "movem.l (%1), %%d0-%%d3\n\t" + "move.l (%2), %%a5\n\t" + "msac.l %%d0, %%a5, 56(%2), %%a5, %%acc0\n\t" + "msac.l %%d1, %%a5, 48(%2), %%a5, %%acc0\n\t" + "msac.l %%d2, %%a5, 40(%2), %%a5, %%acc0\n\t" + "msac.l %%d3, %%a5, 32(%2), %%a5, %%acc0\n\t" + "movem.l 16(%1), %%d0-%%d3\n\t" + "msac.l %%d0, %%a5, 24(%2), %%a5, %%acc0\n\t" + "msac.l %%d1, %%a5, 16(%2), %%a5, %%acc0\n\t" + "msac.l %%d2, %%a5, 8(%2), %%a5, %%acc0\n\t" + "msac.l %%d3, %%a5, 8(%4), %%a5, %%acc0\n\t" + + "movem.l 16(%3), %%d0-%%d3\n\t" + "mac.l %%d3, %%a5, 16(%4), %%a5, %%acc0\n\t" + "mac.l %%d2, %%a5, 24(%4), %%a5, %%acc0\n\t" + "mac.l %%d1, %%a5, 32(%4), %%a5, %%acc0\n\t" + "mac.l %%d0, %%a5, 40(%4), %%a5, %%acc0\n\t" + "movem.l (%3), %%d0-%%d3\n\t" + "mac.l %%d3, %%a5, 48(%4), %%a5, %%acc0\n\t" + "mac.l %%d2, %%a5, 56(%4), %%a5, %%acc0\n\t" + "mac.l %%d1, %%a5, (%4), %%a5, %%acc0\n\t" + "mac.l %%d0, %%a5, %%acc0\n\t" + "movclr.l %%acc0, %0\n\t" + : "=r" (hi) + : "a" (*fo), "a" (*Dptr + po), "a" (*fe), "a" (*Dptr + pe) + : "d0", "d1", "d2", "d3", "a5"); +#else asm volatile ( "movem.l (%1), %%d0-%%d7\n\t" "move.l (%2), %%a5\n\t" @@ -668,7 +702,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, : "=r" (hi) : "a" (*fo), "a" (*Dptr + po), "a" (*fe), "a" (*Dptr + pe) : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a5"); - +#endif *pcm1++ = hi << 3; asm volatile( diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index f389accd51..f3dd334848 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -75,6 +75,13 @@ void *my_malloc(size_t size) return alloc; } +/* Using #define isn't enough with GCC 4.0.1 */ + +void* memcpy(void* dst, const void* src, size_t size) +{ + return rb->memcpy(dst, src, size); +} + void setmallocpos(void *pointer) { audio_bufferpointer = pointer; diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index 71acfdbbcc..9e902e7dca 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h @@ -75,7 +75,6 @@ void savestate(int fd); #define read(a,b,c) rb->read((a),(b),(c)) #define write(a,b,c) rb->write((a),(b),(c)) #define memset(a,b,c) rb->memset((a),(b),(c)) -#define memcpy(a,b,c) rb->memcpy((a),(b),(c)) #define strcpy(a,b) rb->strcpy((a),(b)) #define strncpy(a,b,c) rb->strncpy((a),(b),(c)) #define strlen(a) rb->strlen((a)) @@ -91,3 +90,5 @@ void savestate(int fd); #define fdprintf(...) rb->fdprintf(__VA_ARGS__) #define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_) +/* Using #define isn't enough with GCC 4.0.1 */ +void* memcpy(void* dst, const void* src, size_t size); -- cgit v1.2.3