diff options
author | simonm <unknown> | 1998-06-05 14:44:07 +0000 |
---|---|---|
committer | simonm <unknown> | 1998-06-05 14:44:07 +0000 |
commit | 7bf2d1c3eb931af6192c2e95ac1881d7a9d6ff2c (patch) | |
tree | f8b2cfa68dab04b24b4a0bd3bed22177f4acc189 /ghc/rts/gmp/mpn | |
parent | 8a53169e2204eb4a9988d602e608ddee846d4007 (diff) | |
download | haskell-7bf2d1c3eb931af6192c2e95ac1881d7a9d6ff2c.tar.gz |
[project @ 1998-06-05 14:44:06 by simonm]
Import GMP 2.0.2
Diffstat (limited to 'ghc/rts/gmp/mpn')
-rw-r--r-- | ghc/rts/gmp/mpn/pyr/add_n.s | 76 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/pyr/addmul_1.s | 45 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/pyr/mul_1.s | 42 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/pyr/sub_n.s | 76 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/sh/add_n.s | 47 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/sh/sh2/addmul_1.s | 53 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/sh/sh2/mul_1.s | 50 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/sh/sh2/submul_1.s | 53 | ||||
-rw-r--r-- | ghc/rts/gmp/mpn/sh/sub_n.s | 47 |
9 files changed, 489 insertions, 0 deletions
diff --git a/ghc/rts/gmp/mpn/pyr/add_n.s b/ghc/rts/gmp/mpn/pyr/add_n.s new file mode 100644 index 0000000000..416c660205 --- /dev/null +++ b/ghc/rts/gmp/mpn/pyr/add_n.s @@ -0,0 +1,76 @@ +# Pyramid __mpn_add_n -- Add two limb vectors of the same length > 0 and store +# sum in a third limb vector. + +# Copyright (C) 1995 Free Software Foundation, Inc. + +# This file is part of the GNU MP Library. + +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. + +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +# License for more details. + +# You should have received a copy of the GNU Library General Public License +# along with the GNU MP Library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + +.text + .align 2 +.globl ___mpn_add_n +___mpn_add_n: + movw $-1,tr0 # representation for carry clear + + movw pr3,tr2 + andw $3,tr2 + beq Lend0 + subw tr2,pr3 + +Loop0: rsubw $0,tr0 # restore carry bit from carry-save register + + movw (pr1),tr1 + addwc (pr2),tr1 + movw tr1,(pr0) + + subwb tr0,tr0 + addw $4,pr0 + addw $4,pr1 + addw $4,pr2 + addw $-1,tr2 + bne Loop0 + + mtstw pr3,pr3 + beq Lend +Lend0: +Loop: rsubw $0,tr0 # restore carry bit from carry-save register + + movw (pr1),tr1 + addwc (pr2),tr1 + movw tr1,(pr0) + + movw 4(pr1),tr1 + addwc 4(pr2),tr1 + movw tr1,4(pr0) + + movw 8(pr1),tr1 + addwc 8(pr2),tr1 + movw tr1,8(pr0) + + movw 12(pr1),tr1 + addwc 12(pr2),tr1 + movw tr1,12(pr0) + + subwb tr0,tr0 + addw $16,pr0 + addw $16,pr1 + addw $16,pr2 + addw $-4,pr3 + bne Loop +Lend: + mnegw tr0,pr0 + ret diff --git a/ghc/rts/gmp/mpn/pyr/addmul_1.s b/ghc/rts/gmp/mpn/pyr/addmul_1.s new file mode 100644 index 0000000000..a1495cac8f --- /dev/null +++ b/ghc/rts/gmp/mpn/pyr/addmul_1.s @@ -0,0 +1,45 @@ +# Pyramid __mpn_addmul_1 -- Multiply a limb vector with a limb and add +# the result to a second limb vector. + +# Copyright (C) 1995 Free Software Foundation, Inc. + +# This file is part of the GNU MP Library. + +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. + +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +# License for more details. + +# You should have received a copy of the GNU Library General Public License +# along with the GNU MP Library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + +.text + .align 2 +.globl ___mpn_addmul_1 +___mpn_addmul_1: + mova (pr0)[pr2*4],pr0 + mova (pr1)[pr2*4],pr1 + mnegw pr2,pr2 + movw $0,tr3 + +Loop: movw (pr1)[pr2*4],tr1 + uemul pr3,tr0 + addw tr3,tr1 + movw $0,tr3 + addwc tr0,tr3 + movw (pr0)[pr2*0x4],tr0 + addw tr0,tr1 + addwc $0,tr3 + movw tr1,(pr0)[pr2*4] + addw $1,pr2 + bne Loop + + movw tr3,pr0 + ret diff --git a/ghc/rts/gmp/mpn/pyr/mul_1.s b/ghc/rts/gmp/mpn/pyr/mul_1.s new file mode 100644 index 0000000000..e6b97910f9 --- /dev/null +++ b/ghc/rts/gmp/mpn/pyr/mul_1.s @@ -0,0 +1,42 @@ +# Pyramid __mpn_mul_1 -- Multiply a limb vector with a limb and store +# the result in a second limb vector. + +# Copyright (C) 1995 Free Software Foundation, Inc. + +# This file is part of the GNU MP Library. + +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. + +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +# License for more details. + +# You should have received a copy of the GNU Library General Public License +# along with the GNU MP Library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + +.text + .align 2 +.globl ___mpn_mul_1 +___mpn_mul_1: + mova (pr0)[pr2*4],pr0 + mova (pr1)[pr2*4],pr1 + mnegw pr2,pr2 + movw $0,tr3 + +Loop: movw (pr1)[pr2*4],tr1 + uemul pr3,tr0 + addw tr3,tr1 + movw $0,tr3 + addwc tr0,tr3 + movw tr1,(pr0)[pr2*4] + addw $1,pr2 + bne Loop + + movw tr3,pr0 + ret diff --git a/ghc/rts/gmp/mpn/pyr/sub_n.s b/ghc/rts/gmp/mpn/pyr/sub_n.s new file mode 100644 index 0000000000..5664859cf0 --- /dev/null +++ b/ghc/rts/gmp/mpn/pyr/sub_n.s @@ -0,0 +1,76 @@ +# Pyramid __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and +# store difference in a third limb vector. + +# Copyright (C) 1995 Free Software Foundation, Inc. + +# This file is part of the GNU MP Library. + +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. + +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +# License for more details. + +# You should have received a copy of the GNU Library General Public License +# along with the GNU MP Library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + +.text + .align 2 +.globl ___mpn_sub_n +___mpn_sub_n: + movw $-1,tr0 # representation for carry clear + + movw pr3,tr2 + andw $3,tr2 + beq Lend0 + subw tr2,pr3 + +Loop0: rsubw $0,tr0 # restore carry bit from carry-save register + + movw (pr1),tr1 + subwb (pr2),tr1 + movw tr1,(pr0) + + subwb tr0,tr0 + addw $4,pr0 + addw $4,pr1 + addw $4,pr2 + addw $-1,tr2 + bne Loop0 + + mtstw pr3,pr3 + beq Lend +Lend0: +Loop: rsubw $0,tr0 # restore carry bit from carry-save register + + movw (pr1),tr1 + subwb (pr2),tr1 + movw tr1,(pr0) + + movw 4(pr1),tr1 + subwb 4(pr2),tr1 + movw tr1,4(pr0) + + movw 8(pr1),tr1 + subwb 8(pr2),tr1 + movw tr1,8(pr0) + + movw 12(pr1),tr1 + subwb 12(pr2),tr1 + movw tr1,12(pr0) + + subwb tr0,tr0 + addw $16,pr0 + addw $16,pr1 + addw $16,pr2 + addw $-4,pr3 + bne Loop +Lend: + mnegw tr0,pr0 + ret diff --git a/ghc/rts/gmp/mpn/sh/add_n.s b/ghc/rts/gmp/mpn/sh/add_n.s new file mode 100644 index 0000000000..93dad51e48 --- /dev/null +++ b/ghc/rts/gmp/mpn/sh/add_n.s @@ -0,0 +1,47 @@ +! SH __mpn_add_n -- Add two limb vectors of the same length > 0 and store +! sum in a third limb vector. + +! Copyright (C) 1995 Free Software Foundation, Inc. + +! This file is part of the GNU MP Library. + +! The GNU MP Library is free software; you can redistribute it and/or modify +! it under the terms of the GNU Library General Public License as published by +! the Free Software Foundation; either version 2 of the License, or (at your +! option) any later version. + +! The GNU MP Library is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +! License for more details. + +! You should have received a copy of the GNU Library General Public License +! along with the GNU MP Library; see the file COPYING.LIB. If not, write to +! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +! MA 02111-1307, USA. + + +! INPUT PARAMETERS +! res_ptr r4 +! s1_ptr r5 +! s2_ptr r6 +! size r7 + + .text + .align 2 + .global ___mpn_add_n +___mpn_add_n: + mov #0,r3 ! clear cy save reg + +Loop: mov.l @r5+,r1 + mov.l @r6+,r2 + shlr r3 ! restore cy + addc r2,r1 + movt r3 ! save cy + mov.l r1,@r4 + dt r7 + bf.s Loop + add #4,r4 + + rts + movt r0 ! return carry-out from most sign. limb diff --git a/ghc/rts/gmp/mpn/sh/sh2/addmul_1.s b/ghc/rts/gmp/mpn/sh/sh2/addmul_1.s new file mode 100644 index 0000000000..19d81da3d6 --- /dev/null +++ b/ghc/rts/gmp/mpn/sh/sh2/addmul_1.s @@ -0,0 +1,53 @@ +! SH2 __mpn_addmul_1 -- Multiply a limb vector with a limb and add +! the result to a second limb vector. + +! Copyright (C) 1995 Free Software Foundation, Inc. + +! This file is part of the GNU MP Library. + +! The GNU MP Library is free software; you can redistribute it and/or modify +! it under the terms of the GNU Library General Public License as published by +! the Free Software Foundation; either version 2 of the License, or (at your +! option) any later version. + +! The GNU MP Library is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +! License for more details. + +! You should have received a copy of the GNU Library General Public License +! along with the GNU MP Library; see the file COPYING.LIB. If not, write to +! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +! MA 02111-1307, USA. + + +! INPUT PARAMETERS +! res_ptr r4 +! s1_ptr r5 +! size r6 +! s2_limb r7 + + .text + .align 1 + .global ___mpn_addmul_1 +___mpn_addmul_1: + mov #0,r2 ! cy_limb = 0 + mov #0,r0 ! Keep r0 = 0 for entire loop + clrt + +Loop: mov.l @r5+,r3 + dmulu.l r3,r7 + sts macl,r1 + addc r2,r1 ! lo_prod += old cy_limb + sts mach,r2 ! new cy_limb = hi_prod + mov.l @r4,r3 + addc r0,r2 ! cy_limb += T, T = 0 + addc r3,r1 + addc r0,r2 ! cy_limb += T, T = 0 + dt r6 + mov.l r1,@r4 + bf.s Loop + add #4,r4 + + rts + mov r2,r0 diff --git a/ghc/rts/gmp/mpn/sh/sh2/mul_1.s b/ghc/rts/gmp/mpn/sh/sh2/mul_1.s new file mode 100644 index 0000000000..7ca275671f --- /dev/null +++ b/ghc/rts/gmp/mpn/sh/sh2/mul_1.s @@ -0,0 +1,50 @@ +! SH2 __mpn_mul_1 -- Multiply a limb vector with a limb and store +! the result in a second limb vector. + +! Copyright (C) 1995 Free Software Foundation, Inc. + +! This file is part of the GNU MP Library. + +! The GNU MP Library is free software; you can redistribute it and/or modify +! it under the terms of the GNU Library General Public License as published by +! the Free Software Foundation; either version 2 of the License, or (at your +! option) any later version. + +! The GNU MP Library is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +! License for more details. + +! You should have received a copy of the GNU Library General Public License +! along with the GNU MP Library; see the file COPYING.LIB. If not, write to +! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +! MA 02111-1307, USA. + + +! INPUT PARAMETERS +! res_ptr r4 +! s1_ptr r5 +! size r6 +! s2_limb r7 + + .text + .align 1 + .global ___mpn_mul_1 +___mpn_mul_1: + mov #0,r2 ! cy_limb = 0 + mov #0,r0 ! Keep r0 = 0 for entire loop + clrt + +Loop: mov.l @r5+,r3 + dmulu.l r3,r7 + sts macl,r1 + addc r2,r1 + sts mach,r2 + addc r0,r2 ! propagate carry to cy_limb (dt clobbers T) + dt r6 + mov.l r1,@r4 + bf.s Loop + add #4,r4 + + rts + mov r2,r0 diff --git a/ghc/rts/gmp/mpn/sh/sh2/submul_1.s b/ghc/rts/gmp/mpn/sh/sh2/submul_1.s new file mode 100644 index 0000000000..9ef380ced9 --- /dev/null +++ b/ghc/rts/gmp/mpn/sh/sh2/submul_1.s @@ -0,0 +1,53 @@ +! SH2 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract +! the result from a second limb vector. + +! Copyright (C) 1995 Free Software Foundation, Inc. + +! This file is part of the GNU MP Library. + +! The GNU MP Library is free software; you can redistribute it and/or modify +! it under the terms of the GNU Library General Public License as published by +! the Free Software Foundation; either version 2 of the License, or (at your +! option) any later version. + +! The GNU MP Library is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +! License for more details. + +! You should have received a copy of the GNU Library General Public License +! along with the GNU MP Library; see the file COPYING.LIB. If not, write to +! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +! MA 02111-1307, USA. + + +! INPUT PARAMETERS +! res_ptr r4 +! s1_ptr r5 +! size r6 +! s2_limb r7 + + .text + .align 1 + .global ___mpn_submul_1 +___mpn_submul_1: + mov #0,r2 ! cy_limb = 0 + mov #0,r0 ! Keep r0 = 0 for entire loop + clrt + +Loop: mov.l @r5+,r3 + dmulu.l r3,r7 + sts macl,r1 + addc r2,r1 ! lo_prod += old cy_limb + sts mach,r2 ! new cy_limb = hi_prod + mov.l @r4,r3 + addc r0,r2 ! cy_limb += T, T = 0 + subc r3,r1 + addc r0,r2 ! cy_limb += T, T = 0 + dt r6 + mov.l r1,@r4 + bf.s Loop + add #4,r4 + + rts + mov r2,r0 diff --git a/ghc/rts/gmp/mpn/sh/sub_n.s b/ghc/rts/gmp/mpn/sh/sub_n.s new file mode 100644 index 0000000000..6b201f60fe --- /dev/null +++ b/ghc/rts/gmp/mpn/sh/sub_n.s @@ -0,0 +1,47 @@ +! SH __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and store +! difference in a third limb vector. + +! Copyright (C) 1995 Free Software Foundation, Inc. + +! This file is part of the GNU MP Library. + +! The GNU MP Library is free software; you can redistribute it and/or modify +! it under the terms of the GNU Library General Public License as published by +! the Free Software Foundation; either version 2 of the License, or (at your +! option) any later version. + +! The GNU MP Library is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +! License for more details. + +! You should have received a copy of the GNU Library General Public License +! along with the GNU MP Library; see the file COPYING.LIB. If not, write to +! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +! MA 02111-1307, USA. + + +! INPUT PARAMETERS +! res_ptr r4 +! s1_ptr r5 +! s2_ptr r6 +! size r7 + + .text + .align 2 + .global ___mpn_sub_n +___mpn_sub_n: + mov #0,r3 ! clear cy save reg + +Loop: mov.l @r5+,r1 + mov.l @r6+,r2 + shlr r3 ! restore cy + subc r2,r1 + movt r3 ! save cy + mov.l r1,@r4 + dt r7 + bf.s Loop + add #4,r4 + + rts + movt r0 ! return carry-out from most sign. limb |