Bill Allombert on Sun, 29 Jan 2006 18:11:55 +0100


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

possible solution for the asm kernel breakage


Hello PARI developers,

Some of the asm-inline level0 kernel are currently broken in CVS because they do not
default to portable kernel when needed.

Here an attempt to fix that for powerpc and amd64. 

Basically we add src/kernel/none/level0.h and src/kernel/none/divll.h
before the asm-inline kernel, and we ajust headers a bit to avoid
symbol clash.

Once the process is finalised, I will implement it for the other
asm-inline level0 kernels.

Cheers,
Bill

Index: src/kernel/none/level0.h
===================================================================
RCS file: /home/cvs/pari/src/kernel/none/level0.h,v
retrieving revision 1.13
diff -u -r1.13 level0.h
--- src/kernel/none/level0.h	26 Jan 2006 17:53:32 -0000	1.13
+++ src/kernel/none/level0.h	29 Jan 2006 16:40:18 -0000
@@ -20,6 +21,7 @@
 #ifdef  LEVEL0
 #  undef INLINE_IS_STATIC
 #  undef  INLINE
+#  undef  ASMINLINE
 #  define INLINE
 #endif
 #ifdef  LEVEL1
@@ -30,7 +32,7 @@
 #define LOCAL_OVERFLOW
 #define LOCAL_HIREMAINDER
 
-#if !defined(INLINE) || defined(INLINE_IS_STATIC)
+#if !defined(INLINE) || defined(INLINE_IS_STATIC) || defined(ASMINLINE)
 ulong overflow, hiremainder;
 long addll(ulong x, ulong y);
 long addllx(ulong x, ulong y);
Index: src/kernel/ppc/MakeLVL0.SH
===================================================================
RCS file: /home/cvs/pari/src/kernel/ppc/MakeLVL0.SH,v
retrieving revision 1.3
diff -u -r1.3 MakeLVL0.SH
--- src/kernel/ppc/MakeLVL0.SH	3 Dec 2004 12:13:07 -0000	1.3
+++ src/kernel/ppc/MakeLVL0.SH	29 Jan 2006 16:40:18 -0000
@@ -4,8 +4,8 @@
 none=$src/kernel/none
 
 cat >> $file << EOT
-parilvl0.h: $level0/asm0.h $none/divll.h
-	cat $level0/asm0.h $none/divll.h > parilvl0.h
+parilvl0.h: $none/level0.h $none/divll.h $level0/asm0.h
+	cat $none/level0.h $none/divll.h $level0/asm0.h > parilvl0.h
 kernel\$(_O): $none/level0.h pariinl.h
 	\$(CC) -c \$(CFLAGS) \$(DLCFLAGS) \$(CPPFLAGS) -o kernel\$(_O) $none/level0.c
 EOT
Index: src/kernel/ppc/asm0.h
===================================================================
RCS file: /home/cvs/pari/src/kernel/ppc/asm0.h,v
retrieving revision 1.2
diff -u -r1.2 asm0.h
--- src/kernel/ppc/asm0.h	22 Jul 2004 15:28:32 -0000	1.2
+++ src/kernel/ppc/asm0.h	29 Jan 2006 16:40:18 -0000
@@ -13,24 +14,10 @@
 with the package; see the file 'COPYING'. If not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
 
-#ifndef ASMINLINE
+#ifdef ASMINLINE
+#undef LOCAL_OVERFLOW
+#undef LOCAL_HIREMAINDER
 
-#define LOCAL_OVERFLOW
-#define LOCAL_HIREMAINDER
-
-extern ulong overflow, hiremainder;
-extern long addll(ulong a, ulong b);
-extern long addllx(ulong a, ulong b);
-extern long subll(ulong a, ulong b);
-extern long subllx(ulong a, ulong b);
-extern long shiftl(ulong x, ulong y);
-extern long shiftlr(ulong x, ulong y);
-extern long mulll(ulong x, ulong y);
-extern long addmul(ulong x, ulong y);
-extern long bfffo(ulong x); 
-
-#else /* ASMINLINE */
-/* From the PARI source, using gcc __asm__ format. */
 #define LOCAL_HIREMAINDER  register ulong hiremainder
 #define LOCAL_OVERFLOW     register ulong overflow
 
Index: src/kernel/x86_64/MakeLVL0.SH
===================================================================
RCS file: /home/cvs/pari/src/kernel/x86_64/MakeLVL0.SH,v
retrieving revision 1.3
diff -u -r1.3 MakeLVL0.SH
--- src/kernel/x86_64/MakeLVL0.SH	3 Dec 2004 21:38:08 -0000	1.3
+++ src/kernel/x86_64/MakeLVL0.SH	29 Jan 2006 16:40:18 -0000
@@ -1,12 +1,12 @@
-# Level 0 kernel is "asm inline" if gcc and "asm extern" if not
+# Level 0 kernel is "asm inline" if gcc and "portable" if not
 
 level0=$src/kernel/$kernlvl0
 none=$src/kernel/none
 
 cat >> $file << EOT
-parilvl0.h: $level0/asm0.h 
-	cat $level0/asm0.h > parilvl0.h
-kernel\$(_O): $none/level0.h pariinl.h
+parilvl0.h: $none/level0.h $none/divll.h $level0/asm0.h 
+	cat $none/level0.h $none/divll.h $level0/asm0.h > parilvl0.h
+kernel\$(_O): pariinl.h
 	\$(CC) -c \$(CFLAGS) \$(DLCFLAGS) \$(CPPFLAGS) -o kernel\$(_O) $none/level0.c
 EOT
 
Index: src/kernel/x86_64/asm0.h
===================================================================
RCS file: /home/cvs/pari/src/kernel/x86_64/asm0.h,v
retrieving revision 1.2
diff -u -r1.2 asm0.h
--- src/kernel/x86_64/asm0.h	22 Jul 2004 15:28:32 -0000	1.2
+++ src/kernel/x86_64/asm0.h	29 Jan 2006 16:40:18 -0000
@@ -17,24 +17,11 @@
 /* Written by Bill Allombert from the ix86 version by Bruno Haible. Basically
  * change insl to insq*/
 
-#ifndef ASMINLINE
+#ifdef ASMINLINE
 
-#define LOCAL_OVERFLOW
-#define LOCAL_HIREMAINDER
-
-extern ulong overflow, hiremainder;
-extern long addll(ulong a, ulong b);
-extern long addllx(ulong a, ulong b);
-extern long subll(ulong a, ulong b);
-extern long subllx(ulong a, ulong b);
-extern long shiftl(ulong x, ulong y);
-extern long shiftlr(ulong x, ulong y);
-extern long mulll(ulong x, ulong y);
-extern long addmul(ulong x, ulong y);
-extern long divll(ulong x, ulong y);
-extern long bfffo(ulong x);
-
-#else /* ASMINLINE */
+#undef LOCAL_OVERFLOW
+#undef LOCAL_HIREMAINDER
+#undef divll
 
 #define LOCAL_HIREMAINDER  register ulong hiremainder
 #define LOCAL_OVERFLOW     register ulong overflow