aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/longlong.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/lib/longlong.h')
-rw-r--r--arch/arm/lib/longlong.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/arch/arm/lib/longlong.h b/arch/arm/lib/longlong.h
index 179eea4edc35..90ae647e4d76 100644
--- a/arch/arm/lib/longlong.h
+++ b/arch/arm/lib/longlong.h
@@ -26,18 +26,18 @@
26 26
27#define __BITS4 (SI_TYPE_SIZE / 4) 27#define __BITS4 (SI_TYPE_SIZE / 4)
28#define __ll_B (1L << (SI_TYPE_SIZE / 2)) 28#define __ll_B (1L << (SI_TYPE_SIZE / 2))
29#define __ll_lowpart(t) ((USItype) (t) % __ll_B) 29#define __ll_lowpart(t) ((u32) (t) % __ll_B)
30#define __ll_highpart(t) ((USItype) (t) / __ll_B) 30#define __ll_highpart(t) ((u32) (t) / __ll_B)
31 31
32/* Define auxiliary asm macros. 32/* Define auxiliary asm macros.
33 33
34 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) 34 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand)
35 multiplies two USItype integers MULTIPLER and MULTIPLICAND, 35 multiplies two u32 integers MULTIPLER and MULTIPLICAND,
36 and generates a two-part USItype product in HIGH_PROD and 36 and generates a two-part u32 product in HIGH_PROD and
37 LOW_PROD. 37 LOW_PROD.
38 38
39 2) __umulsidi3(a,b) multiplies two USItype integers A and B, 39 2) __umulsidi3(a,b) multiplies two u32 integers A and B,
40 and returns a UDItype product. This is just a variant of umul_ppmm. 40 and returns a u64 product. This is just a variant of umul_ppmm.
41 41
42 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, 42 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
43 denominator) divides a two-word unsigned integer, composed by the 43 denominator) divides a two-word unsigned integer, composed by the
@@ -77,23 +77,23 @@
77#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ 77#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
78 __asm__ ("adds %1, %4, %5 \n\ 78 __asm__ ("adds %1, %4, %5 \n\
79 adc %0, %2, %3" \ 79 adc %0, %2, %3" \
80 : "=r" ((USItype) (sh)), \ 80 : "=r" ((u32) (sh)), \
81 "=&r" ((USItype) (sl)) \ 81 "=&r" ((u32) (sl)) \
82 : "%r" ((USItype) (ah)), \ 82 : "%r" ((u32) (ah)), \
83 "rI" ((USItype) (bh)), \ 83 "rI" ((u32) (bh)), \
84 "%r" ((USItype) (al)), \ 84 "%r" ((u32) (al)), \
85 "rI" ((USItype) (bl))) 85 "rI" ((u32) (bl)))
86#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ 86#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
87 __asm__ ("subs %1, %4, %5 \n\ 87 __asm__ ("subs %1, %4, %5 \n\
88 sbc %0, %2, %3" \ 88 sbc %0, %2, %3" \
89 : "=r" ((USItype) (sh)), \ 89 : "=r" ((u32) (sh)), \
90 "=&r" ((USItype) (sl)) \ 90 "=&r" ((u32) (sl)) \
91 : "r" ((USItype) (ah)), \ 91 : "r" ((u32) (ah)), \
92 "rI" ((USItype) (bh)), \ 92 "rI" ((u32) (bh)), \
93 "r" ((USItype) (al)), \ 93 "r" ((u32) (al)), \
94 "rI" ((USItype) (bl))) 94 "rI" ((u32) (bl)))
95#define umul_ppmm(xh, xl, a, b) \ 95#define umul_ppmm(xh, xl, a, b) \
96{register USItype __t0, __t1, __t2; \ 96{register u32 __t0, __t1, __t2; \
97 __asm__ ("%@ Inlined umul_ppmm \n\ 97 __asm__ ("%@ Inlined umul_ppmm \n\
98 mov %2, %5, lsr #16 \n\ 98 mov %2, %5, lsr #16 \n\
99 mov %0, %6, lsr #16 \n\ 99 mov %0, %6, lsr #16 \n\
@@ -107,14 +107,14 @@
107 addcs %0, %0, #65536 \n\ 107 addcs %0, %0, #65536 \n\
108 adds %1, %1, %3, lsl #16 \n\ 108 adds %1, %1, %3, lsl #16 \n\
109 adc %0, %0, %3, lsr #16" \ 109 adc %0, %0, %3, lsr #16" \
110 : "=&r" ((USItype) (xh)), \ 110 : "=&r" ((u32) (xh)), \
111 "=r" ((USItype) (xl)), \ 111 "=r" ((u32) (xl)), \
112 "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ 112 "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
113 : "r" ((USItype) (a)), \ 113 : "r" ((u32) (a)), \
114 "r" ((USItype) (b)));} 114 "r" ((u32) (b)));}
115#define UMUL_TIME 20 115#define UMUL_TIME 20
116#define UDIV_TIME 100 116#define UDIV_TIME 100
117#endif /* __arm__ */ 117#endif /* __arm__ */
118 118
119#define __umulsidi3(u, v) \ 119#define __umulsidi3(u, v) \
120 ({DIunion __w; \ 120 ({DIunion __w; \
@@ -123,14 +123,14 @@
123 123
124#define __udiv_qrnnd_c(q, r, n1, n0, d) \ 124#define __udiv_qrnnd_c(q, r, n1, n0, d) \
125 do { \ 125 do { \
126 USItype __d1, __d0, __q1, __q0; \ 126 u32 __d1, __d0, __q1, __q0; \
127 USItype __r1, __r0, __m; \ 127 u32 __r1, __r0, __m; \
128 __d1 = __ll_highpart (d); \ 128 __d1 = __ll_highpart (d); \
129 __d0 = __ll_lowpart (d); \ 129 __d0 = __ll_lowpart (d); \
130 \ 130 \
131 __r1 = (n1) % __d1; \ 131 __r1 = (n1) % __d1; \
132 __q1 = (n1) / __d1; \ 132 __q1 = (n1) / __d1; \
133 __m = (USItype) __q1 * __d0; \ 133 __m = (u32) __q1 * __d0; \
134 __r1 = __r1 * __ll_B | __ll_highpart (n0); \ 134 __r1 = __r1 * __ll_B | __ll_highpart (n0); \
135 if (__r1 < __m) \ 135 if (__r1 < __m) \
136 { \ 136 { \
@@ -143,7 +143,7 @@
143 \ 143 \
144 __r0 = __r1 % __d1; \ 144 __r0 = __r1 % __d1; \
145 __q0 = __r1 / __d1; \ 145 __q0 = __r1 / __d1; \
146 __m = (USItype) __q0 * __d0; \ 146 __m = (u32) __q0 * __d0; \
147 __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ 147 __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
148 if (__r0 < __m) \ 148 if (__r0 < __m) \
149 { \ 149 { \
@@ -154,7 +154,7 @@
154 } \ 154 } \
155 __r0 -= __m; \ 155 __r0 -= __m; \
156 \ 156 \
157 (q) = (USItype) __q1 * __ll_B | __q0; \ 157 (q) = (u32) __q1 * __ll_B | __q0; \
158 (r) = __r0; \ 158 (r) = __r0; \
159 } while (0) 159 } while (0)
160 160
@@ -163,14 +163,14 @@
163 163
164#define count_leading_zeros(count, x) \ 164#define count_leading_zeros(count, x) \
165 do { \ 165 do { \
166 USItype __xr = (x); \ 166 u32 __xr = (x); \
167 USItype __a; \ 167 u32 __a; \
168 \ 168 \
169 if (SI_TYPE_SIZE <= 32) \ 169 if (SI_TYPE_SIZE <= 32) \
170 { \ 170 { \
171 __a = __xr < ((USItype)1<<2*__BITS4) \ 171 __a = __xr < ((u32)1<<2*__BITS4) \
172 ? (__xr < ((USItype)1<<__BITS4) ? 0 : __BITS4) \ 172 ? (__xr < ((u32)1<<__BITS4) ? 0 : __BITS4) \
173 : (__xr < ((USItype)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \ 173 : (__xr < ((u32)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \
174 } \ 174 } \
175 else \ 175 else \
176 { \ 176 { \