Commit 734c3ce3 authored by Greg Ungerer's avatar Greg Ungerer

m68k: use kernel processor defines for conditional optimizations

Older m68k-linux compilers will include pre-defined symbols that
confuse what processor it is being targeted for. For example gcc-4.1.2
will pre-define __mc68020__ even if you specify the target processor
as -m68000 on the gcc command line. Newer versions of gcc have this
corrected.

In a few places the m68k code uses defined(__mc68020__) for optimizations
that include instructions that are specific to the CPU 68020 and above.
When compiling with older compilers this will be true even when we have
selected to compile for the older 68000 processors.

Switch to using the kernel processor defines, CONFIG_M68020 and friends.
Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
parent 62356725
...@@ -14,8 +14,7 @@ EXPORT_SYMBOL(__ashrdi3); ...@@ -14,8 +14,7 @@ EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__lshrdi3); EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(__muldi3); EXPORT_SYMBOL(__muldi3);
#if !defined(__mc68020__) && !defined(__mc68030__) && \ #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE)
!defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcpu32__)
/* /*
* Simpler 68k and ColdFire parts also need a few other gcc functions. * Simpler 68k and ColdFire parts also need a few other gcc functions.
*/ */
......
...@@ -34,8 +34,10 @@ void *memcpy(void *to, const void *from, size_t n) ...@@ -34,8 +34,10 @@ void *memcpy(void *to, const void *from, size_t n)
if (temp) { if (temp) {
long *lto = to; long *lto = to;
const long *lfrom = from; const long *lfrom = from;
#if defined(__mc68020__) || defined(__mc68030__) || \ #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE)
defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) for (; temp; temp--)
*lto++ = *lfrom++;
#else
asm volatile ( asm volatile (
" movel %2,%3\n" " movel %2,%3\n"
" andw #7,%3\n" " andw #7,%3\n"
...@@ -56,9 +58,6 @@ void *memcpy(void *to, const void *from, size_t n) ...@@ -56,9 +58,6 @@ void *memcpy(void *to, const void *from, size_t n)
" jpl 4b" " jpl 4b"
: "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1) : "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1)
: "0" (lfrom), "1" (lto), "2" (temp)); : "0" (lfrom), "1" (lto), "2" (temp));
#else
for (; temp; temp--)
*lto++ = *lfrom++;
#endif #endif
to = lto; to = lto;
from = lfrom; from = lfrom;
......
...@@ -32,8 +32,10 @@ void *memset(void *s, int c, size_t count) ...@@ -32,8 +32,10 @@ void *memset(void *s, int c, size_t count)
temp = count >> 2; temp = count >> 2;
if (temp) { if (temp) {
long *ls = s; long *ls = s;
#if defined(__mc68020__) || defined(__mc68030__) || \ #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE)
defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) for (; temp; temp--)
*ls++ = c;
#else
size_t temp1; size_t temp1;
asm volatile ( asm volatile (
" movel %1,%2\n" " movel %1,%2\n"
...@@ -55,9 +57,6 @@ void *memset(void *s, int c, size_t count) ...@@ -55,9 +57,6 @@ void *memset(void *s, int c, size_t count)
" jpl 1b" " jpl 1b"
: "=a" (ls), "=d" (temp), "=&d" (temp1) : "=a" (ls), "=d" (temp), "=&d" (temp1)
: "d" (c), "0" (ls), "1" (temp)); : "d" (c), "0" (ls), "1" (temp));
#else
for (; temp; temp--)
*ls++ = c;
#endif #endif
s = ls; s = ls;
} }
......
...@@ -19,17 +19,7 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -19,17 +19,7 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#if defined(__mc68020__) || defined(__mc68030__) || \ #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE)
defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("mulu%.l %3,%1:%0" \
: "=d" ((USItype)(w0)), \
"=d" ((USItype)(w1)) \
: "%0" ((USItype)(u)), \
"dmi" ((USItype)(v)))
#else
#define SI_TYPE_SIZE 32 #define SI_TYPE_SIZE 32
#define __BITS4 (SI_TYPE_SIZE / 4) #define __BITS4 (SI_TYPE_SIZE / 4)
...@@ -61,6 +51,15 @@ Boston, MA 02111-1307, USA. */ ...@@ -61,6 +51,15 @@ Boston, MA 02111-1307, USA. */
(w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
} while (0) } while (0)
#else
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("mulu%.l %3,%1:%0" \
: "=d" ((USItype)(w0)), \
"=d" ((USItype)(w1)) \
: "%0" ((USItype)(u)), \
"dmi" ((USItype)(v)))
#endif #endif
#define __umulsidi3(u, v) \ #define __umulsidi3(u, v) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment