diff options
author | uweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-30 20:51:57 +0000 |
---|---|---|
committer | uweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-30 20:51:57 +0000 |
commit | ca1d712746e1517b357d437070c6b15efdeaf122 (patch) | |
tree | 975fe3a8a36af2ace3e26572e4d24e6279bb340f /gcc | |
parent | d4daba2111d2e60a24eb3fc64002fc1b9bdefc94 (diff) | |
download | gcc-ca1d712746e1517b357d437070c6b15efdeaf122.tar.gz |
* longlong.h: Partially synchronize with GMP-4.1 version:
Use i370 definitions also for s390.
Add generic definition of umul_ppmm in terms of smul_ppmm.
[s390] (umul_ppmm): Remove.
[s390] (smul_ppmm): Fix incorrect assembler constraints.
[s390] (smul_ppmm, sdiv_qrnnd): Rename __xx to __x.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57670 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/longlong.h | 53 |
2 files changed, 34 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cddaf407efb..d8073b4d418 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2002-09-30 Ulrich Weigand <uweigand@de.ibm.com> + + * longlong.h: Partially synchronize with GMP-4.1 version: + Use i370 definitions also for s390. + Add generic definition of umul_ppmm in terms of smul_ppmm. + [s390] (umul_ppmm): Remove. + [s390] (smul_ppmm): Fix incorrect assembler constraints. + [s390] (smul_ppmm, sdiv_qrnnd): Rename __xx to __x. + 2002-09-30 Bob Wilson <bob.wilson@acm.org> * config/xtensa/xtensa.h (REG_CLASS_NAMES, REG_CLASS_CONTENTS): diff --git a/gcc/longlong.h b/gcc/longlong.h index ca1dc7b3b4d..83ce96564b6 100644 --- a/gcc/longlong.h +++ b/gcc/longlong.h @@ -292,44 +292,27 @@ UDItype __umulsidi3 (USItype, USItype); } while (0) #endif -#if (defined (__i370__) || defined (__mvs__)) && W_TYPE_SIZE == 32 -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (__m0), \ - "r" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) +#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32 #define smul_ppmm(xh, xl, m0, m1) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (m0), \ - "r" (m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ + } __x; \ + __asm__ ("lr %N0,%1\n\tmr %0,%2" \ + : "=&r" (__x.__ll) \ + : "r" (m0), "r" (m1)); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ } while (0) #define sdiv_qrnnd(q, r, n1, n0, d) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ - } __xx; \ - __xx.__i.__h = n1; __xx.__i.__l = n0; \ + } __x; \ + __x.__i.__h = n1; __x.__i.__l = n0; \ __asm__ ("dr %0,%2" \ - : "=r" (__xx.__ll) \ - : "0" (__xx.__ll), "r" (d)); \ - (q) = __xx.__i.__l; (r) = __xx.__i.__h; \ + : "=r" (__x.__ll) \ + : "0" (__x.__ll), "r" (d)); \ + (q) = __x.__i.__l; (r) = __x.__i.__h; \ } while (0) #endif @@ -1201,6 +1184,20 @@ UDItype __umulsidi3 (USItype, USItype); } while (0) #endif +/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of + smul_ppmm. */ +#if !defined (umul_ppmm) && defined (smul_ppmm) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UWtype __w1; \ + UWtype __xm0 = (u), __xm1 = (v); \ + smul_ppmm (__w1, w0, __xm0, __xm1); \ + (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \ + + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \ + } while (0) +#endif + +/* If we still don't have umul_ppmm, define it using plain C. */ #if !defined (umul_ppmm) #define umul_ppmm(w1, w0, u, v) \ do { \ |