This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 64 bit sparc solaris and gmp 4.0.1


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-solaris2.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]