bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Re: 64 bit sparc solaris and gmp 4.0.1


From: Teemu Torma
Subject: Fwd: Re: 64 bit sparc solaris and gmp 4.0.1
Date: Mon, 20 May 2002 22:30:55 +0200

Compiling gmp 4.0.1 for 64 bit solaris using gcc 3.1 does not compile.  Please 
see the attached Jakub Jelinex's reply, which solves the compilatioan problem 
and all tests pass.

Teemu

----------  Forwarded Message  ----------

Subject: Re: 64 bit sparc solaris and gmp 4.0.1
Date: Fri, 17 May 2002 15:21:38 +0200
From: Jakub Jelinek <address@hidden>
To: Teemu Torma <address@hidden>
Cc: address@hidden

On Fri, May 17, 2002 at 02:39:44PM +0200, Teemu Torma wrote:
> I am trying to compile gmp 4.0.1 with gcc 3.1 using 64 bit sparc solaris
> 2.7. It compiles mostly just fine, and I have compiled other 64 bit
> binaries successfully.
>
> For some reason when compiling mpn/divrem_1.c, assembler does not like the
> gcc output:
>
> /usr/gnu/gcc31/lib/gcc-lib/sparc-sun-solaris2.7/3.1/../../../../sparc-sun-s
>olaris2.7/bin/as --gstabs -V -Qy -s -K PIC -64 -Av9a -o .libs/divrem_1.o
> divrem_1.s GNU assembler version 2.12.1 (sparc-sun-solaris2.7) using BFD
> version 2.12.1 divrem_1.s: Assembler messages:
> divrem_1.s:400: Error: Illegal operands
> divrem_1.s:401: Error: Illegal operands
> divrem_1.s:1001: Error: Illegal operands
> divrem_1.s:1002: Error: Illegal operands
>
> The offending lines look in both cases like (except register names):
>
>       subcc   0,%i1,%i4
>       subccc  0,%i0,%g0
>
> I don't know sparc assembler enough to tell if this is a gcc or gas
> problem. Any ideas?

Looks like very buggy longlong.h in gmp 4.0.1 (gcc's longlong.h looks ok):

#if defined (__sparc__) && W_TYPE_SIZE == 64
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
  __asm__ (                                                             \
       "addcc   %4,%5,%1\n"                                             \
      " addccc  %6,%7,%%g0\n"                                           \
      " addc    %2,%3,%0"                                               \

          : "=r" (sh), "=&r" (sl)                                       \
          : "%rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),               \

            "rJ" ((al) >> 32), "rJ" ((bl) >> 32)                        \
           __CLOBBER_CC)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
  __asm__ (                                                             \
       "subcc   %4,%5,%1\n"                                             \
      " subccc  %6,%7,%%g0\n"                                           \
      " subc    %2,%3,%0"                                               \

          : "=r" (sh), "=&r" (sl)                                       \
          : "%rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),               \

            "rJ" ((al) >> 32), "rJ" ((bl) >> 32)                        \
           __CLOBBER_CC)
#endif

First of all, whenever rJ is used, it should use r prefix.
Ie. %r2, %r4, %r6. Using rJ for %7 is bogus, it should use "rI".
And last, but not least, using % for sub_ddmmss is obviously bogus.
So it should look like:

#if defined (__sparc__) && W_TYPE_SIZE == 64
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
  __asm__ (                                                             \
       "addcc   %r4,%5,%1\n"                                            \
      " addccc  %r6,%7,%%g0\n"                                          \
      " addc    %r2,%3,%0"                                              \

          : "=r" (sh), "=&r" (sl)                                       \
          : "%rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),               \

            "rJ" ((al) >> 32), "rI" ((bl) >> 32)                        \
           __CLOBBER_CC)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
  __asm__ (                                                             \
       "subcc   %r4,%5,%1\n"                                            \
      " subccc  %r6,%7,%%g0\n"                                          \
      " subc    %r2,%3,%0"                                              \

          : "=r" (sh), "=&r" (sl)                                       \
          : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl),                 \

            "rJ" ((al) >> 32), "rI" ((bl) >> 32)                        \
           __CLOBBER_CC)
#endif

        Jakub

-------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]