diff options
| author | Greg Ungerer <gerg@uclinux.org> | 2011-03-21 23:39:27 -0400 |
|---|---|---|
| committer | Greg Ungerer <gerg@uclinux.org> | 2011-03-25 00:05:13 -0400 |
| commit | 66d857b08b8c3ed5c72c361f863cce77d2a978d7 (patch) | |
| tree | 47222d86f4d78dc0da31baf64188bd2e4b38ac1e /arch/m68k/lib/muldi3_mm.c | |
| parent | d39dd11c3e6a7af5c20bfac40594db36cf270f42 (diff) | |
m68k: merge m68k and m68knommu arch directories
There is a lot of common code that could be shared between the m68k
and m68knommu arch branches. It makes sense to merge the two branches
into a single directory structure so that we can more easily share
that common code.
This is a brute force merge, based on a script from Stephen King
<sfking@fdwdc.com>, which was originally written by Arnd Bergmann
<arnd@arndb.de>.
> The script was inspired by the script Sam Ravnborg used to merge the
> includes from m68knommu. For those files common to both arches but
> differing in content, the m68k version of the file is renamed to
> <file>_mm.<ext> and the m68knommu version of the file is moved into the
> corresponding m68k directory and renamed <file>_no.<ext> and a small
> wrapper file <file>.<ext> is used to select between the two version. Files
> that are common to both but don't differ are removed from the m68knommu
> tree and files and directories that are unique to the m68knommu tree are
> moved to the m68k tree. Finally, the arch/m68knommu tree is removed.
>
> To select between the the versions of the files, the wrapper uses
>
> #ifdef CONFIG_MMU
> #include <file>_mm.<ext>
> #else
> #include <file>_no.<ext>
> #endif
On top of this file merge I have done a simplistic merge of m68k and
m68knommu Kconfig, which primarily attempts to keep existing options and
menus in place. Other than a handful of options being moved it produces
identical .config outputs on m68k and m68knommu targets I tested it on.
With this in place there is now quite a bit of scope for merge cleanups
in future patches.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/lib/muldi3_mm.c')
| -rw-r--r-- | arch/m68k/lib/muldi3_mm.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/m68k/lib/muldi3_mm.c b/arch/m68k/lib/muldi3_mm.c new file mode 100644 index 000000000000..be4f275649e3 --- /dev/null +++ b/arch/m68k/lib/muldi3_mm.c | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and | ||
| 2 | gcc-2.7.2.3/longlong.h which is: */ | ||
| 3 | /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU CC. | ||
| 6 | |||
| 7 | GNU CC is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | any later version. | ||
| 11 | |||
| 12 | GNU CC is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU CC; see the file COPYING. If not, write to | ||
| 19 | the Free Software Foundation, 59 Temple Place - Suite 330, | ||
| 20 | Boston, MA 02111-1307, USA. */ | ||
| 21 | |||
| 22 | #define BITS_PER_UNIT 8 | ||
| 23 | |||
| 24 | #define umul_ppmm(w1, w0, u, v) \ | ||
| 25 | __asm__ ("mulu%.l %3,%1:%0" \ | ||
| 26 | : "=d" ((USItype)(w0)), \ | ||
| 27 | "=d" ((USItype)(w1)) \ | ||
| 28 | : "%0" ((USItype)(u)), \ | ||
| 29 | "dmi" ((USItype)(v))) | ||
| 30 | |||
| 31 | #define __umulsidi3(u, v) \ | ||
| 32 | ({DIunion __w; \ | ||
| 33 | umul_ppmm (__w.s.high, __w.s.low, u, v); \ | ||
| 34 | __w.ll; }) | ||
| 35 | |||
| 36 | typedef int SItype __attribute__ ((mode (SI))); | ||
| 37 | typedef unsigned int USItype __attribute__ ((mode (SI))); | ||
| 38 | typedef int DItype __attribute__ ((mode (DI))); | ||
| 39 | typedef int word_type __attribute__ ((mode (__word__))); | ||
| 40 | |||
| 41 | struct DIstruct {SItype high, low;}; | ||
| 42 | |||
| 43 | typedef union | ||
| 44 | { | ||
| 45 | struct DIstruct s; | ||
| 46 | DItype ll; | ||
| 47 | } DIunion; | ||
| 48 | |||
| 49 | DItype | ||
| 50 | __muldi3 (DItype u, DItype v) | ||
| 51 | { | ||
| 52 | DIunion w; | ||
| 53 | DIunion uu, vv; | ||
| 54 | |||
| 55 | uu.ll = u, | ||
| 56 | vv.ll = v; | ||
| 57 | |||
| 58 | w.ll = __umulsidi3 (uu.s.low, vv.s.low); | ||
| 59 | w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high | ||
| 60 | + (USItype) uu.s.high * (USItype) vv.s.low); | ||
| 61 | |||
| 62 | return w.ll; | ||
| 63 | } | ||
