Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Greg Ungerer <gerg@uclinux.org>

+19 -23
+1 -2
arch/m68k/kernel/m68k_ksyms.c
··· 14 14 EXPORT_SYMBOL(__lshrdi3); 15 15 EXPORT_SYMBOL(__muldi3); 16 16 17 - #if !defined(__mc68020__) && !defined(__mc68030__) && \ 18 - !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcpu32__) 17 + #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 19 18 /* 20 19 * Simpler 68k and ColdFire parts also need a few other gcc functions. 21 20 */
+4 -5
arch/m68k/lib/memcpy.c
··· 34 34 if (temp) { 35 35 long *lto = to; 36 36 const long *lfrom = from; 37 - #if defined(__mc68020__) || defined(__mc68030__) || \ 38 - defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 37 + #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 38 + for (; temp; temp--) 39 + *lto++ = *lfrom++; 40 + #else 39 41 asm volatile ( 40 42 " movel %2,%3\n" 41 43 " andw #7,%3\n" ··· 58 56 " jpl 4b" 59 57 : "=a" (lfrom), "=a" (lto), "=d" (temp), "=&d" (temp1) 60 58 : "0" (lfrom), "1" (lto), "2" (temp)); 61 - #else 62 - for (; temp; temp--) 63 - *lto++ = *lfrom++; 64 59 #endif 65 60 to = lto; 66 61 from = lfrom;
+4 -5
arch/m68k/lib/memset.c
··· 32 32 temp = count >> 2; 33 33 if (temp) { 34 34 long *ls = s; 35 - #if defined(__mc68020__) || defined(__mc68030__) || \ 36 - defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 35 + #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 36 + for (; temp; temp--) 37 + *ls++ = c; 38 + #else 37 39 size_t temp1; 38 40 asm volatile ( 39 41 " movel %1,%2\n" ··· 57 55 " jpl 1b" 58 56 : "=a" (ls), "=d" (temp), "=&d" (temp1) 59 57 : "d" (c), "0" (ls), "1" (temp)); 60 - #else 61 - for (; temp; temp--) 62 - *ls++ = c; 63 58 #endif 64 59 s = ls; 65 60 }
+10 -11
arch/m68k/lib/muldi3.c
··· 19 19 the Free Software Foundation, 59 Temple Place - Suite 330, 20 20 Boston, MA 02111-1307, USA. */ 21 21 22 - #if defined(__mc68020__) || defined(__mc68030__) || \ 23 - defined(__mc68040__) || defined(__mc68060__) || defined(__mcpu32__) 24 - 25 - #define umul_ppmm(w1, w0, u, v) \ 26 - __asm__ ("mulu%.l %3,%1:%0" \ 27 - : "=d" ((USItype)(w0)), \ 28 - "=d" ((USItype)(w1)) \ 29 - : "%0" ((USItype)(u)), \ 30 - "dmi" ((USItype)(v))) 31 - 32 - #else 22 + #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 33 23 34 24 #define SI_TYPE_SIZE 32 35 25 #define __BITS4 (SI_TYPE_SIZE / 4) ··· 50 60 (w1) = __x3 + __ll_highpart (__x1); \ 51 61 (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ 52 62 } while (0) 63 + 64 + #else 65 + 66 + #define umul_ppmm(w1, w0, u, v) \ 67 + __asm__ ("mulu%.l %3,%1:%0" \ 68 + : "=d" ((USItype)(w0)), \ 69 + "=d" ((USItype)(w1)) \ 70 + : "%0" ((USItype)(u)), \ 71 + "dmi" ((USItype)(v))) 53 72 54 73 #endif 55 74