aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/lib
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2012-12-13 11:46:31 -0500
committerMichal Simek <michal.simek@xilinx.com>2012-12-13 12:15:36 -0500
commita671de086874b9d8155369319b2bd989cf55d77c (patch)
treeb75db9044e4037566e4f11aa9e7b781f3ffc4b67 /arch/microblaze/lib
parentc0d997fb4c4f202c55a4ed8ab9b714a81a16e5ac (diff)
microblaze: lib: Remove helper macros
Remove these gcc types and use standard types. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch/microblaze/lib')
-rw-r--r--arch/microblaze/lib/muldi3.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/arch/microblaze/lib/muldi3.c b/arch/microblaze/lib/muldi3.c
index 0585bccb7fad..d3659244ab6f 100644
--- a/arch/microblaze/lib/muldi3.c
+++ b/arch/microblaze/lib/muldi3.c
@@ -2,32 +2,28 @@
2 2
3#include "libgcc.h" 3#include "libgcc.h"
4 4
5#define DWtype long long
6#define UWtype unsigned long
7#define UHWtype unsigned short
8
9#define W_TYPE_SIZE 32 5#define W_TYPE_SIZE 32
10 6
11#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) 7#define __ll_B ((unsigned long) 1 << (W_TYPE_SIZE / 2))
12#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) 8#define __ll_lowpart(t) ((unsigned long) (t) & (__ll_B - 1))
13#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) 9#define __ll_highpart(t) ((unsigned long) (t) >> (W_TYPE_SIZE / 2))
14 10
15/* If we still don't have umul_ppmm, define it using plain C. */ 11/* If we still don't have umul_ppmm, define it using plain C. */
16#if !defined(umul_ppmm) 12#if !defined(umul_ppmm)
17#define umul_ppmm(w1, w0, u, v) \ 13#define umul_ppmm(w1, w0, u, v) \
18 do { \ 14 do { \
19 UWtype __x0, __x1, __x2, __x3; \ 15 unsigned long __x0, __x1, __x2, __x3; \
20 UHWtype __ul, __vl, __uh, __vh; \ 16 unsigned short __ul, __vl, __uh, __vh; \
21 \ 17 \
22 __ul = __ll_lowpart(u); \ 18 __ul = __ll_lowpart(u); \
23 __uh = __ll_highpart(u); \ 19 __uh = __ll_highpart(u); \
24 __vl = __ll_lowpart(v); \ 20 __vl = __ll_lowpart(v); \
25 __vh = __ll_highpart(v); \ 21 __vh = __ll_highpart(v); \
26 \ 22 \
27 __x0 = (UWtype) __ul * __vl; \ 23 __x0 = (unsigned long) __ul * __vl; \
28 __x1 = (UWtype) __ul * __vh; \ 24 __x1 = (unsigned long) __ul * __vh; \
29 __x2 = (UWtype) __uh * __vl; \ 25 __x2 = (unsigned long) __uh * __vl; \
30 __x3 = (UWtype) __uh * __vh; \ 26 __x3 = (unsigned long) __uh * __vh; \
31 \ 27 \
32 __x1 += __ll_highpart(__x0); /* this can't give carry */\ 28 __x1 += __ll_highpart(__x0); /* this can't give carry */\
33 __x1 += __x2; /* but this indeed can */ \ 29 __x1 += __x2; /* but this indeed can */ \
@@ -47,14 +43,14 @@
47 }) 43 })
48#endif 44#endif
49 45
50DWtype __muldi3(DWtype u, DWtype v) 46long long __muldi3(long long u, long long v)
51{ 47{
52 const DWunion uu = {.ll = u}; 48 const DWunion uu = {.ll = u};
53 const DWunion vv = {.ll = v}; 49 const DWunion vv = {.ll = v};
54 DWunion w = {.ll = __umulsidi3(uu.s.low, vv.s.low)}; 50 DWunion w = {.ll = __umulsidi3(uu.s.low, vv.s.low)};
55 51
56 w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high 52 w.s.high += ((unsigned long) uu.s.low * (unsigned long) vv.s.high
57 + (UWtype) uu.s.high * (UWtype) vv.s.low); 53 + (unsigned long) uu.s.high * (unsigned long) vv.s.low);
58 54
59 return w.ll; 55 return w.ll;
60} 56}