linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: gcc 3.3-2 complains with arch/i386/meth-emu/poly.h
@ 2003-06-05 16:58 Dan Kegel
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Kegel @ 2003-06-05 16:58 UTC (permalink / raw)
  To: m.bagni; +Cc: linux-kernel

Hi Marco,
thanks for your post - yes, we definitely need to be able to
compile with gcc-3.3.  Since it looks like you're a newcomer,
here are a few tips:

When you post changes like this,
please mention which version of the kernel source you're starting from.

Also, the preferred format for posting
changes like this is as an inline patch; see
http://www.tux.org/lkml/#s1-10
http://www.tux.org/lkml/#s4-1
http://www.kegel.com/academy/opensource.html#patches

Finally, check a recent version of the kernel before posting a patch.
It looks like this issue has been fixed in 2.5; see
http://lxr.linux.no/source/arch/i386/math-emu/poly.h?v=2.5.56
You might want to check 2.4.21-pre6 to see if it's been
fixed there yet, and if not, submit a patch to Marcello,
preferably using the same approach used in the 2.5 fix.
- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045


^ permalink raw reply	[flat|nested] 2+ messages in thread

* gcc 3.3-2 complains with arch/i386/meth-emu/poly.h
@ 2003-06-05 14:00 Marco Bagni
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Bagni @ 2003-06-05 14:00 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

Dear Sirs,

I have found a minor bug in the file "arch/i386/meth-emu/poly.h".

It seems that gcc does not allow anymore the "implicit" continuation
of a string in the next line and complains during the compilation of the
file "arch/i386/meth-emu/poly.h" in the execution of the asm directive
of the functions "add_Xsig_Xsig" and "add_two_Xsig". I have added my
"changes" which I submit to your attention.

I know that nobody uses this math-emulation code anymore, but if it has 
to be in Kernel, it must be possible to compile it without problems.

Regards

Marco Bagni

[-- Attachment #2: poly.h --]
[-- Type: text/x-chdr, Size: 4845 bytes --]

/*---------------------------------------------------------------------------+
 |  poly.h                                                                   |
 |                                                                           |
 |  Header file for the FPU-emu poly*.c source files.                        |
 |                                                                           |
 | Copyright (C) 1994,1999                                                   |
 |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
 |                       Australia.  E-mail   billm@melbpc.org.au            |
 |                                                                           |
 | Declarations and definitions for functions operating on Xsig (12-byte     |
 | extended-significand) quantities.                                         |
 |                                                                           |
 +---------------------------------------------------------------------------*/

#ifndef _POLY_H
#define _POLY_H

/* This 12-byte structure is used to improve the accuracy of computation
   of transcendental functions.
   Intended to be used to get results better than 8-byte computation
   allows. 9-byte would probably be sufficient.
   */
typedef struct {
  unsigned long lsw;
  unsigned long midw;
  unsigned long msw;
} Xsig;

asmlinkage void mul64(unsigned long long const *a, unsigned long long const *b,
		      unsigned long long *result);
asmlinkage void polynomial_Xsig(Xsig *, const unsigned long long *x,
				const unsigned long long terms[], const int n);

asmlinkage void mul32_Xsig(Xsig *, const unsigned long mult);
asmlinkage void mul64_Xsig(Xsig *, const unsigned long long *mult);
asmlinkage void mul_Xsig_Xsig(Xsig *dest, const Xsig *mult);

asmlinkage void shr_Xsig(Xsig *, const int n);
asmlinkage int round_Xsig(Xsig *);
asmlinkage int norm_Xsig(Xsig *);
asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, const Xsig *dest);

/* Macro to extract the most significant 32 bits from a long long */
#define LL_MSW(x)     (((unsigned long *)&x)[1])

/* Macro to initialize an Xsig struct */
#define MK_XSIG(a,b,c)     { c, b, a }

/* Macro to access the 8 ms bytes of an Xsig as a long long */
#define XSIG_LL(x)         (*(unsigned long long *)&x.midw)


/*
   Need to run gcc with optimizations on to get these to
   actually be in-line.
   */

/* Multiply two fixed-point 32 bit numbers, producing a 32 bit result.
   The answer is the ms word of the product. */
/* Some versions of gcc make it difficult to stop eax from being clobbered.
   Merely specifying that it is used doesn't work...
 */
static inline unsigned long mul_32_32(const unsigned long arg1,
				      const unsigned long arg2)
{
  int retval;
  asm volatile ("mull %2; movl %%edx,%%eax" \
		:"=a" (retval) \
		:"0" (arg1), "g" (arg2) \
		:"dx");
  return retval;
}

/* Changed by Marco Bagni */
/* Add the 12 byte Xsig x2 to Xsig dest, with no checks for overflow. */
static inline void add_Xsig_Xsig(Xsig *dest, const Xsig *x2)
{
  asm volatile ("movl %1,%%edi; movl %2,%%esi; "
                "movl (%%esi),%%eax; addl %%eax,(%%edi); "
                "movl 4(%%esi),%%eax; adcl %%eax,4(%%edi); "
                "movl 8(%%esi),%%eax; adcl %%eax,8(%%edi);"
                 :"=g" (*dest):"g" (dest), "g" (x2)
                 :"ax","si","di");
}

/* Changed by Marco Bagni */
/* Add the 12 byte Xsig x2 to Xsig dest, adjust exp if overflow occurs. */
/* Note: the constraints in the asm statement didn't always work properly
   with gcc 2.5.8.  Changing from using edi to using ecx got around the
   problem, but keep fingers crossed! */
static inline void add_two_Xsig(Xsig *dest, const Xsig *x2, long int *exp)
{
  asm volatile ("movl %2,%%ecx; movl %3,%%esi; "
                "movl (%%esi),%%eax; addl %%eax,(%%ecx); "
                "movl 4(%%esi),%%eax; adcl %%eax,4(%%ecx); "
                "movl 8(%%esi),%%eax; adcl %%eax,8(%%ecx); "
                "jnc 0f; "
		"rcrl 8(%%ecx); rcrl 4(%%ecx); rcrl (%%ecx); "
                "movl %4,%%ecx; incl (%%ecx); "
                "movl $1,%%eax; jmp 1f; "
                "0: xorl %%eax,%%eax; "
                "1:"
		:"=g" (*exp), "=g" (*dest)
		:"g" (dest), "g" (x2), "g" (exp)
		:"cx","si","ax");
}


/* Negate (subtract from 1.0) the 12 byte Xsig */
/* This is faster in a loop on my 386 than using the "neg" instruction. */
static inline void negate_Xsig(Xsig *x)
{
  asm volatile("movl %1,%%esi; "
               "xorl %%ecx,%%ecx; "
               "movl %%ecx,%%eax; subl (%%esi),%%eax; movl %%eax,(%%esi); "
               "movl %%ecx,%%eax; sbbl 4(%%esi),%%eax; movl %%eax,4(%%esi); "
               "movl %%ecx,%%eax; sbbl 8(%%esi),%%eax; movl %%eax,8(%%esi); "
               :"=g" (*x):"g" (x):"si","ax","cx");
}

#endif /* _POLY_H */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-05 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-05 16:58 gcc 3.3-2 complains with arch/i386/meth-emu/poly.h Dan Kegel
  -- strict thread matches above, loose matches on Subject: below --
2003-06-05 14:00 Marco Bagni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).