diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/v850/lib/muldi3.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/v850/lib/muldi3.c')
-rw-r--r-- | arch/v850/lib/muldi3.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/v850/lib/muldi3.c b/arch/v850/lib/muldi3.c new file mode 100644 index 000000000000..277ca25c82c8 --- /dev/null +++ b/arch/v850/lib/muldi3.c | |||
@@ -0,0 +1,61 @@ | |||
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, 2001 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 umul_ppmm(w1, w0, u, v) \ | ||
23 | __asm__ ("mulu %3, %0, %1" \ | ||
24 | : "=r" ((USItype)(w0)), \ | ||
25 | "=r" ((USItype)(w1)) \ | ||
26 | : "%0" ((USItype)(u)), \ | ||
27 | "r" ((USItype)(v))) | ||
28 | |||
29 | #define __umulsidi3(u, v) \ | ||
30 | ({DIunion __w; \ | ||
31 | umul_ppmm (__w.s.high, __w.s.low, u, v); \ | ||
32 | __w.ll; }) | ||
33 | |||
34 | typedef int SItype __attribute__ ((mode (SI))); | ||
35 | typedef unsigned int USItype __attribute__ ((mode (SI))); | ||
36 | typedef int DItype __attribute__ ((mode (DI))); | ||
37 | typedef int word_type __attribute__ ((mode (__word__))); | ||
38 | |||
39 | struct DIstruct {SItype high, low;}; | ||
40 | |||
41 | typedef union | ||
42 | { | ||
43 | struct DIstruct s; | ||
44 | DItype ll; | ||
45 | } DIunion; | ||
46 | |||
47 | DItype | ||
48 | __muldi3 (DItype u, DItype v) | ||
49 | { | ||
50 | DIunion w; | ||
51 | DIunion uu, vv; | ||
52 | |||
53 | uu.ll = u, | ||
54 | vv.ll = v; | ||
55 | |||
56 | w.ll = __umulsidi3 (uu.s.low, vv.s.low); | ||
57 | w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high | ||
58 | + (USItype) uu.s.high * (USItype) vv.s.low); | ||
59 | |||
60 | return w.ll; | ||
61 | } | ||