diff options
Diffstat (limited to 'arch/powerpc/include/asm/sfp-machine.h')
-rw-r--r-- | arch/powerpc/include/asm/sfp-machine.h | 92 |
1 files changed, 29 insertions, 63 deletions
diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h index d89beaba26ff..8b957aabb826 100644 --- a/arch/powerpc/include/asm/sfp-machine.h +++ b/arch/powerpc/include/asm/sfp-machine.h | |||
@@ -213,30 +213,18 @@ | |||
213 | * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow | 213 | * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow |
214 | * (i.e. carry out) is not stored anywhere, and is lost. | 214 | * (i.e. carry out) is not stored anywhere, and is lost. |
215 | */ | 215 | */ |
216 | #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ | 216 | #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ |
217 | do { \ | 217 | do { \ |
218 | if (__builtin_constant_p (bh) && (bh) == 0) \ | 218 | if (__builtin_constant_p (bh) && (bh) == 0) \ |
219 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ | 219 | __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ |
220 | : "=r" ((USItype)(sh)), \ | 220 | : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ |
221 | "=&r" ((USItype)(sl)) \ | 221 | else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ |
222 | : "%r" ((USItype)(ah)), \ | 222 | __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ |
223 | "%r" ((USItype)(al)), \ | 223 | : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ |
224 | "rI" ((USItype)(bl))); \ | ||
225 | else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ | ||
226 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ | ||
227 | : "=r" ((USItype)(sh)), \ | ||
228 | "=&r" ((USItype)(sl)) \ | ||
229 | : "%r" ((USItype)(ah)), \ | ||
230 | "%r" ((USItype)(al)), \ | ||
231 | "rI" ((USItype)(bl))); \ | ||
232 | else \ | 224 | else \ |
233 | __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ | 225 | __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ |
234 | : "=r" ((USItype)(sh)), \ | 226 | : "=r" (sh), "=&r" (sl) \ |
235 | "=&r" ((USItype)(sl)) \ | 227 | : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ |
236 | : "%r" ((USItype)(ah)), \ | ||
237 | "r" ((USItype)(bh)), \ | ||
238 | "%r" ((USItype)(al)), \ | ||
239 | "rI" ((USItype)(bl))); \ | ||
240 | } while (0) | 228 | } while (0) |
241 | 229 | ||
242 | /* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to | 230 | /* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to |
@@ -248,44 +236,24 @@ | |||
248 | * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, | 236 | * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, |
249 | * and is lost. | 237 | * and is lost. |
250 | */ | 238 | */ |
251 | #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ | 239 | #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ |
252 | do { \ | 240 | do { \ |
253 | if (__builtin_constant_p (ah) && (ah) == 0) \ | 241 | if (__builtin_constant_p (ah) && (ah) == 0) \ |
254 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ | 242 | __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ |
255 | : "=r" ((USItype)(sh)), \ | 243 | : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ |
256 | "=&r" ((USItype)(sl)) \ | 244 | else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ |
257 | : "r" ((USItype)(bh)), \ | 245 | __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ |
258 | "rI" ((USItype)(al)), \ | 246 | : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ |
259 | "r" ((USItype)(bl))); \ | ||
260 | else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \ | ||
261 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ | ||
262 | : "=r" ((USItype)(sh)), \ | ||
263 | "=&r" ((USItype)(sl)) \ | ||
264 | : "r" ((USItype)(bh)), \ | ||
265 | "rI" ((USItype)(al)), \ | ||
266 | "r" ((USItype)(bl))); \ | ||
267 | else if (__builtin_constant_p (bh) && (bh) == 0) \ | 247 | else if (__builtin_constant_p (bh) && (bh) == 0) \ |
268 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ | 248 | __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ |
269 | : "=r" ((USItype)(sh)), \ | 249 | : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ |
270 | "=&r" ((USItype)(sl)) \ | 250 | else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ |
271 | : "r" ((USItype)(ah)), \ | 251 | __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ |
272 | "rI" ((USItype)(al)), \ | 252 | : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ |
273 | "r" ((USItype)(bl))); \ | ||
274 | else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ | ||
275 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ | ||
276 | : "=r" ((USItype)(sh)), \ | ||
277 | "=&r" ((USItype)(sl)) \ | ||
278 | : "r" ((USItype)(ah)), \ | ||
279 | "rI" ((USItype)(al)), \ | ||
280 | "r" ((USItype)(bl))); \ | ||
281 | else \ | 253 | else \ |
282 | __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ | 254 | __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ |
283 | : "=r" ((USItype)(sh)), \ | 255 | : "=r" (sh), "=&r" (sl) \ |
284 | "=&r" ((USItype)(sl)) \ | 256 | : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ |
285 | : "r" ((USItype)(ah)), \ | ||
286 | "r" ((USItype)(bh)), \ | ||
287 | "rI" ((USItype)(al)), \ | ||
288 | "r" ((USItype)(bl))); \ | ||
289 | } while (0) | 257 | } while (0) |
290 | 258 | ||
291 | /* asm fragments for mul and div */ | 259 | /* asm fragments for mul and div */ |
@@ -294,13 +262,10 @@ | |||
294 | * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype | 262 | * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype |
295 | * word product in HIGH_PROD and LOW_PROD. | 263 | * word product in HIGH_PROD and LOW_PROD. |
296 | */ | 264 | */ |
297 | #define umul_ppmm(ph, pl, m0, m1) \ | 265 | #define umul_ppmm(ph, pl, m0, m1) \ |
298 | do { \ | 266 | do { \ |
299 | USItype __m0 = (m0), __m1 = (m1); \ | 267 | USItype __m0 = (m0), __m1 = (m1); \ |
300 | __asm__ ("mulhwu %0,%1,%2" \ | 268 | __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ |
301 | : "=r" ((USItype)(ph)) \ | ||
302 | : "%r" (__m0), \ | ||
303 | "r" (__m1)); \ | ||
304 | (pl) = __m0 * __m1; \ | 269 | (pl) = __m0 * __m1; \ |
305 | } while (0) | 270 | } while (0) |
306 | 271 | ||
@@ -312,9 +277,10 @@ | |||
312 | * significant bit of DENOMINATOR must be 1, then the pre-processor symbol | 277 | * significant bit of DENOMINATOR must be 1, then the pre-processor symbol |
313 | * UDIV_NEEDS_NORMALIZATION is defined to 1. | 278 | * UDIV_NEEDS_NORMALIZATION is defined to 1. |
314 | */ | 279 | */ |
315 | #define udiv_qrnnd(q, r, n1, n0, d) \ | 280 | #define udiv_qrnnd(q, r, n1, n0, d) \ |
316 | do { \ | 281 | do { \ |
317 | UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ | 282 | UWtype __d1, __d0, __q1, __q0; \ |
283 | UWtype __r1, __r0, __m; \ | ||
318 | __d1 = __ll_highpart (d); \ | 284 | __d1 = __ll_highpart (d); \ |
319 | __d0 = __ll_lowpart (d); \ | 285 | __d0 = __ll_lowpart (d); \ |
320 | \ | 286 | \ |
@@ -325,7 +291,7 @@ | |||
325 | if (__r1 < __m) \ | 291 | if (__r1 < __m) \ |
326 | { \ | 292 | { \ |
327 | __q1--, __r1 += (d); \ | 293 | __q1--, __r1 += (d); \ |
328 | if (__r1 >= (d)) /* we didn't get carry when adding to __r1 */ \ | 294 | if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ |
329 | if (__r1 < __m) \ | 295 | if (__r1 < __m) \ |
330 | __q1--, __r1 += (d); \ | 296 | __q1--, __r1 += (d); \ |
331 | } \ | 297 | } \ |