From 6b628d3634559ddd84148ed860a0e1e967b5d59c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 1 Mar 1996 18:45:35 +0000 Subject: * stdlib/Makefile (mpn-stuff): New target. (copy-mpn): Use it. * Code copied from GMP updated to 1.937 version. * stdlib/strtod.c (HAVE_ALLOCA): Define this for gmp headers. --- sysdeps/m68k/m68020/addmul_1.S | 75 ++++++++++++++++++++------------------ sysdeps/m68k/m68020/mul_1.S | 83 ++++++++++++++++++++++-------------------- sysdeps/m68k/m68020/submul_1.S | 75 ++++++++++++++++++++------------------ 3 files changed, 121 insertions(+), 112 deletions(-) (limited to 'sysdeps/m68k/m68020') diff --git a/sysdeps/m68k/m68020/addmul_1.S b/sysdeps/m68k/m68020/addmul_1.S index 3f244c40b4..169f1135be 100644 --- a/sysdeps/m68k/m68020/addmul_1.S +++ b/sysdeps/m68k/m68020/addmul_1.S @@ -1,7 +1,7 @@ /* mc68020 __mpn_addmul_1 -- Multiply a limb vector with a limb and add the result to a second limb vector. -Copyright (C) 1992, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,58 +23,61 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ INPUT PARAMETERS res_ptr (sp + 4) s1_ptr (sp + 8) - size (sp + 12) + s1_size (sp + 12) s2_limb (sp + 16) */ +#include "sysdep.h" #include "asm-syntax.h" TEXT ALIGN - GLOBL ___mpn_addmul_1 + GLOBL C_SYMBOL_NAME(__mpn_addmul_1) -LAB(___mpn_addmul_1) +C_SYMBOL_NAME(__mpn_addmul_1:) +PROLOG(__mpn_addmul_1) #define res_ptr a0 #define s1_ptr a1 -#define size d2 +#define s1_size d2 #define s2_limb d4 /* Save used registers on the stack. */ - INSN2(movem,l ,MEM_PREDEC(sp),d2-d5) + moveml R(d2)-R(d5),MEM_PREDEC(sp) /* Copy the arguments to registers. Better use movem? */ - INSN2(move,l ,res_ptr,MEM_DISP(sp,20)) - INSN2(move,l ,s1_ptr,MEM_DISP(sp,24)) - INSN2(move,l ,size,MEM_DISP(sp,28)) - INSN2(move,l ,s2_limb,MEM_DISP(sp,32)) - - INSN2(eor,w ,size,#1) - INSN1(clr,l ,d1) - INSN1(clr,l ,d5) - INSN2(lsr,l ,size,#1) - bcc L1 - INSN2(subq,l ,size,#1) - INSN2(sub,l ,d0,d0) /* (d0,cy) <= (0,0) */ - -LAB(Loop) - INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d1:d3,s2_limb) - INSN2(addx,l ,d3,d0) - INSN2(addx,l ,d1,d5) - INSN2(add,l ,MEM_POSTINC(res_ptr),d3) -LAB(L1) INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d0:d3,s2_limb) - INSN2(addx,l ,d3,d1) - INSN2(addx,l ,d0,d5) - INSN2(add,l ,MEM_POSTINC(res_ptr),d3) - - dbf size,Loop - INSN2(addx,l ,d0,d5) - INSN2(sub,l ,size,#0x10000) - bcc Loop + movel MEM_DISP(sp,20),R(res_ptr) + movel MEM_DISP(sp,24),R(s1_ptr) + movel MEM_DISP(sp,28),R(s1_size) + movel MEM_DISP(sp,32),R(s2_limb) + + eorw #1,R(s1_size) + clrl R(d1) + clrl R(d5) + lsrl #1,R(s1_size) + bcc L(L1) + subql #1,R(s1_size) + subl R(d0),R(d0) /* (d0,cy) <= (0,0) */ + +L(Loop:) + movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d1):R(d3) + addxl R(d0),R(d3) + addxl R(d5),R(d1) + addl R(d3),MEM_POSTINC(res_ptr) +L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d0):R(d3) + addxl R(d1),R(d3) + addxl R(d5),R(d0) + addl R(d3),MEM_POSTINC(res_ptr) + + dbf R(s1_size),L(Loop) + addxl R(d5),R(d0) + subl #0x10000,R(s1_size) + bcc L(Loop) /* Restore used registers from stack frame. */ - INSN2(movem,l ,d2-d5,MEM_POSTINC(sp)) + moveml MEM_POSTINC(sp),R(d2)-R(d5) rts +EPILOG(__mpn_addmul_1) diff --git a/sysdeps/m68k/m68020/mul_1.S b/sysdeps/m68k/m68020/mul_1.S index 548ca0091b..4db1ccac25 100644 --- a/sysdeps/m68k/m68020/mul_1.S +++ b/sysdeps/m68k/m68020/mul_1.S @@ -1,7 +1,7 @@ /* mc68020 __mpn_mul_1 -- Multiply a limb vector with a limb and store the result in a second limb vector. -Copyright (C) 1992, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,65 +23,68 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ INPUT PARAMETERS res_ptr (sp + 4) s1_ptr (sp + 8) - size (sp + 12) + s1_size (sp + 12) s2_limb (sp + 16) */ +#include "sysdep.h" #include "asm-syntax.h" TEXT ALIGN - GLOBL ___mpn_mul_1 + GLOBL C_SYMBOL_NAME(__mpn_mul_1) -LAB(___mpn_mul_1) +C_SYMBOL_NAME(__mpn_mul_1:) +PROLOG(__mpn_mul_1) #define res_ptr a0 #define s1_ptr a1 -#define size d2 +#define s1_size d2 #define s2_limb d4 /* Save used registers on the stack. */ - INSN2(movem,l ,MEM_PREDEC(sp),d2-d4) + moveml R(d2)-R(d4),MEM_PREDEC(sp) #if 0 - INSN2(move,l ,MEM_PREDEC(sp),d2) - INSN2(move,l ,MEM_PREDEC(sp),d3) - INSN2(move,l ,MEM_PREDEC(sp),d4) + movel R(d2),MEM_PREDEC(sp) + movel R(d3),MEM_PREDEC(sp) + movel R(d4),MEM_PREDEC(sp) #endif /* Copy the arguments to registers. Better use movem? */ - INSN2(move,l ,res_ptr,MEM_DISP(sp,16)) - INSN2(move,l ,s1_ptr,MEM_DISP(sp,20)) - INSN2(move,l ,size,MEM_DISP(sp,24)) - INSN2(move,l ,s2_limb,MEM_DISP(sp,28)) - - INSN2(eor,w ,size,#1) - INSN1(clr,l ,d1) - INSN2(lsr,l ,size,#1) - bcc L1 - INSN2(subq,l ,size,#1) - INSN2(sub,l ,d0,d0) /* (d0,cy) <= (0,0) */ - -LAB(Loop) - INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d1:d3,s2_limb) - INSN2(addx,l ,d3,d0) - INSN2(move,l ,MEM_POSTINC(res_ptr),d3) -LAB(L1) INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d0:d3,s2_limb) - INSN2(addx,l ,d3,d1) - INSN2(move,l ,MEM_POSTINC(res_ptr),d3) - - dbf size,Loop - INSN1(clr,l ,d3) - INSN2(addx,l ,d0,d3) - INSN2(sub,l ,size,#0x10000) - bcc Loop + movel MEM_DISP(sp,16),R(res_ptr) + movel MEM_DISP(sp,20),R(s1_ptr) + movel MEM_DISP(sp,24),R(s1_size) + movel MEM_DISP(sp,28),R(s2_limb) + + eorw #1,R(s1_size) + clrl R(d1) + lsrl #1,R(s1_size) + bcc L(L1) + subql #1,R(s1_size) + subl R(d0),R(d0) /* (d0,cy) <= (0,0) */ + +L(Loop:) + movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d1):R(d3) + addxl R(d0),R(d3) + movel R(d3),MEM_POSTINC(res_ptr) +L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d0):R(d3) + addxl R(d1),R(d3) + movel R(d3),MEM_POSTINC(res_ptr) + + dbf R(s1_size),L(Loop) + clrl R(d3) + addxl R(d3),R(d0) + subl #0x10000,R(s1_size) + bcc L(Loop) /* Restore used registers from stack frame. */ - INSN2(movem,l ,d2-d4,MEM_POSTINC(sp)) + moveml MEM_POSTINC(sp),R(d2)-R(d4) #if 0 - INSN2(move,l ,d4,MEM_POSTINC(sp)) - INSN2(move,l ,d3,MEM_POSTINC(sp)) - INSN2(move,l ,d2,MEM_POSTINC(sp)) + movel MEM_POSTINC(sp),R(d4) + movel MEM_POSTINC(sp),R(d3) + movel MEM_POSTINC(sp),R(d2) #endif rts +EPILOG(__mpn_mul_1) diff --git a/sysdeps/m68k/m68020/submul_1.S b/sysdeps/m68k/m68020/submul_1.S index ef7f39de7a..cf30029b2f 100644 --- a/sysdeps/m68k/m68020/submul_1.S +++ b/sysdeps/m68k/m68020/submul_1.S @@ -1,7 +1,7 @@ /* mc68020 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract the result from a second limb vector. -Copyright (C) 1992, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,58 +23,61 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ INPUT PARAMETERS res_ptr (sp + 4) s1_ptr (sp + 8) - size (sp + 12) + s1_size (sp + 12) s2_limb (sp + 16) */ +#include "sysdep.h" #include "asm-syntax.h" TEXT ALIGN - GLOBL ___mpn_submul_1 + GLOBL C_SYMBOL_NAME(__mpn_submul_1) -LAB(___mpn_submul_1) +C_SYMBOL_NAME(__mpn_submul_1:) +PROLOG(__mpn_submul_1) #define res_ptr a0 #define s1_ptr a1 -#define size d2 +#define s1_size d2 #define s2_limb d4 /* Save used registers on the stack. */ - INSN2(movem,l ,MEM_PREDEC(sp),d2-d5) + moveml R(d2)-R(d5),MEM_PREDEC(sp) /* Copy the arguments to registers. Better use movem? */ - INSN2(move,l ,res_ptr,MEM_DISP(sp,20)) - INSN2(move,l ,s1_ptr,MEM_DISP(sp,24)) - INSN2(move,l ,size,MEM_DISP(sp,28)) - INSN2(move,l ,s2_limb,MEM_DISP(sp,32)) - - INSN2(eor,w ,size,#1) - INSN1(clr,l ,d1) - INSN1(clr,l ,d5) - INSN2(lsr,l ,size,#1) - bcc L1 - INSN2(subq,l ,size,#1) - INSN2(sub,l ,d0,d0) /* (d0,cy) <= (0,0) */ - -LAB(Loop) - INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d1:d3,s2_limb) - INSN2(addx,l ,d3,d0) - INSN2(addx,l ,d1,d5) - INSN2(sub,l ,MEM_POSTINC(res_ptr),d3) -LAB(L1) INSN2(move,l ,d3,MEM_POSTINC(s1_ptr)) - INSN2(mulu,l ,d0:d3,s2_limb) - INSN2(addx,l ,d3,d1) - INSN2(addx,l ,d0,d5) - INSN2(sub,l ,MEM_POSTINC(res_ptr),d3) - - dbf size,Loop - INSN2(addx,l ,d0,d5) - INSN2(sub,l ,size,#0x10000) - bcc Loop + movel MEM_DISP(sp,20),R(res_ptr) + movel MEM_DISP(sp,24),R(s1_ptr) + movel MEM_DISP(sp,28),R(s1_size) + movel MEM_DISP(sp,32),R(s2_limb) + + eorw #1,R(s1_size) + clrl R(d1) + clrl R(d5) + lsrl #1,R(s1_size) + bcc L(L1) + subql #1,R(s1_size) + subl R(d0),R(d0) /* (d0,cy) <= (0,0) */ + +L(Loop:) + movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d1):R(d3) + addxl R(d0),R(d3) + addxl R(d5),R(d1) + subl R(d3),MEM_POSTINC(res_ptr) +L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) + mulul R(s2_limb),R(d0):R(d3) + addxl R(d1),R(d3) + addxl R(d5),R(d0) + subl R(d3),MEM_POSTINC(res_ptr) + + dbf R(s1_size),L(Loop) + addxl R(d5),R(d0) + subl #0x10000,R(s1_size) + bcc L(Loop) /* Restore used registers from stack frame. */ - INSN2(movem,l ,d2-d5,MEM_POSTINC(sp)) + moveml MEM_POSTINC(sp),R(d2)-R(d5) rts +EPILOG(__mpn_submul_1) -- cgit v1.2.3