linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix 2.4.22-pre broken x86 math-emu
@ 2003-07-02  3:00 Erik Andersen
  2003-07-02 13:52 ` Marcelo Tosatti
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Andersen @ 2003-07-02  3:00 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

As of today's "fix up gcc 3.3 bits" patch [1], x86 math emulation
is now even more broken, since this latest patch has added some
mismatched quotes while still failing to address the actual
problems preventing this code from compiling with gcc 3.3.

This patch, first sent to you on Jun 21st, fixes the missing
semicolons and missing quotes in the x86 math-emu code, allowing
it to compile with gcc 3.3.  I have updated things to also fix
the mismatched quotes that were added today.  Unlike the patch
you applied earlier today, my patch is actually tested...

Please apply,

 -Erik

[1] http://www.kernel.org/diff/diffview.cgi?file=/pub/linux/kernel/v2.4/testing/cset/cset-alan@lxorguk.ukuu.org.uk|ChangeSet|20030701183359|14011.txt

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--


--- linux/arch/i386/math-emu/poly.h.orig	2003-07-01 20:39:49.000000000 -0600
+++ linux/arch/i386/math-emu/poly.h	2003-07-01 20:39:57.000000000 -0600
@@ -64,7 +64,7 @@
 				      const unsigned long arg2)
 {
   int retval;
-  asm volatile ("mull %2; movl %%edx,%%eax" \
+  asm volatile ("mull %2; movl %%edx,%%eax; " \
 		:"=a" (retval) \
 		:"0" (arg1), "g" (arg2) \
 		:"dx");
@@ -75,11 +75,11 @@
 /* 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)
+  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");
 }
 
@@ -90,19 +90,19 @@
    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");
+  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"); 
 }
 
 
@@ -110,11 +110,11 @@
 /* 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); "
+  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");
 }
 

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

* Re: [PATCH] fix 2.4.22-pre broken x86 math-emu
  2003-07-02  3:00 [PATCH] fix 2.4.22-pre broken x86 math-emu Erik Andersen
@ 2003-07-02 13:52 ` Marcelo Tosatti
  2003-07-02 16:22   ` Erik Andersen
  0 siblings, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2003-07-02 13:52 UTC (permalink / raw)
  To: Erik Andersen; +Cc: linux-kernel, Alan Cox



I'm no GCC nor asm guru, so, Alan?


On Tue, 1 Jul 2003, Erik Andersen wrote:

> As of today's "fix up gcc 3.3 bits" patch [1], x86 math emulation
> is now even more broken, since this latest patch has added some
> mismatched quotes while still failing to address the actual
> problems preventing this code from compiling with gcc 3.3.
>
> This patch, first sent to you on Jun 21st, fixes the missing
> semicolons and missing quotes in the x86 math-emu code, allowing
> it to compile with gcc 3.3.  I have updated things to also fix
> the mismatched quotes that were added today.  Unlike the patch
> you applied earlier today, my patch is actually tested...
>
> Please apply,
>
>  -Erik
>
> [1] http://www.kernel.org/diff/diffview.cgi?file=/pub/linux/kernel/v2.4/testing/cset/cset-alan@lxorguk.ukuu.org.uk|ChangeSet|20030701183359|14011.txt
>
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
>
>
> --- linux/arch/i386/math-emu/poly.h.orig	2003-07-01 20:39:49.000000000 -0600
> +++ linux/arch/i386/math-emu/poly.h	2003-07-01 20:39:57.000000000 -0600
> @@ -64,7 +64,7 @@
>  				      const unsigned long arg2)
>  {
>    int retval;
> -  asm volatile ("mull %2; movl %%edx,%%eax" \
> +  asm volatile ("mull %2; movl %%edx,%%eax; " \
>  		:"=a" (retval) \
>  		:"0" (arg1), "g" (arg2) \
>  		:"dx");
> @@ -75,11 +75,11 @@
>  /* 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)
> +  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");
>  }
>
> @@ -90,19 +90,19 @@
>     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");
> +  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");
>  }
>
>
> @@ -110,11 +110,11 @@
>  /* 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); "
> +  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");
>  }
>
>

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

* Re: [PATCH] fix 2.4.22-pre broken x86 math-emu
  2003-07-02 13:52 ` Marcelo Tosatti
@ 2003-07-02 16:22   ` Erik Andersen
  2003-07-02 21:01     ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Andersen @ 2003-07-02 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel, Alan Cox

On Wed Jul 02, 2003 at 10:52:02AM -0300, Marcelo Tosatti wrote:
> 
> 
> I'm no GCC nor asm guru, so, Alan?

This does not change even one asm instruction.  This merely
changes the quoting and semicolons...

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

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

* Re: [PATCH] fix 2.4.22-pre broken x86 math-emu
  2003-07-02 16:22   ` Erik Andersen
@ 2003-07-02 21:01     ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2003-07-02 21:01 UTC (permalink / raw)
  To: andersen; +Cc: Marcelo Tosatti, Linux Kernel Mailing List

On Mer, 2003-07-02 at 17:22, Erik Andersen wrote:
> On Wed Jul 02, 2003 at 10:52:02AM -0300, Marcelo Tosatti wrote:
> > 
> > 
> > I'm no GCC nor asm guru, so, Alan?
> 
> This does not change even one asm instruction.  This merely
> changes the quoting and semicolons...

Erik is right - I sent you a buggy fix, then a correct fix, but
his cleanup is nicer



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

end of thread, other threads:[~2003-07-02 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02  3:00 [PATCH] fix 2.4.22-pre broken x86 math-emu Erik Andersen
2003-07-02 13:52 ` Marcelo Tosatti
2003-07-02 16:22   ` Erik Andersen
2003-07-02 21:01     ` Alan Cox

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