On Tue, 2015-02-03 at 10:57 +0100, Torbjörn Granlund wrote: > Marc Glisse <marc.gli...@inria.fr> writes: > > Apparently not, the motivation for the patch is that multu has > disappeared... > > Then I see no other robust approach than making mpn/mipsnomultu_64 (or > somesuch). > > Well, an analogous robust approach would be moving the dmultu code into > mpn/mips64/dmultu and put the r6 code into mpn/mips64/nodmultu. > > (As a side note, I have been planning to move things around a bit, > creating mpn/x86/32 and mpn/x86/64 with the contents of mpn/x86 and > mpn/x86_64, respectively. SImilarly for powerpc32 and powerpc64, > sparc32 and sparc64, etc. Common code between 32-bit and 64-bit limbs > will live in the shared directory (mpn/x86, mpn/powerpc, mpn/sparc, > etc). There is a good amount of such common code already, which is > shared in an ugly manner.)
OK, so what I did was to create a mips32r6 directory under mips32 and a mips64r6 directory under mips64 and put copies of the routines that had to be changed for r6 in those directories. I have done test builds for various MIPS targets and verified that the non-r6 code has not changed. For the new r6 stuff I have verified that it all builds but I haven't tested the changes with 'make check'. Is there a way to do 'make check' with a simulator or a remote system? I usually build MIPS code using a cross compiler on an x86 Linux box and that is what I did to build GMP (using --build=x86_64-unknown-linux-gnu --host=mips-img-linux-gnu or some other host depending on what flavor of MIPS I wanted to build). I was hoping I could run 'make check' on the x86 box and have it run tests via a simulator. That makes it easier to build and test multiple MIPS architectures. I tweaked the GMP configure script to recognize mips*-mti-* and mips*-img-* targets, these hosts/targets exist in GCC and binutils as names to use for cross compilers targeting MIPS (mti for pre-r6, img for r6). I have attached the patch as it currently exists to this email so people could look it over. Steve Ellcey sell...@imgtec.com
diff -r 2ff56d3c5dfe configure.ac --- a/configure.ac Wed Aug 27 11:24:26 2014 +0200 +++ b/configure.ac Thu Feb 05 14:27:13 2015 -0800 @@ -907,27 +907,41 @@ gcc_cflags_optlist="abi" gcc_cflags_abi="-mabi=32" gcc_testlist="gcc-mips-o32" - path="mips32" + case $host in + mips32r6 | mips*-img-*) + path="mips32/mips32r6 mips32" ;; + *) + path="mips32" ;; + esac cc_cflags="-O2 -o32" # no -g, it disables all optimizations # this suits both mips32 and mips64 GMP_INCLUDE_MPN(mips32/mips-defs.m4) case $host in - [mips64*-*-* | mips*-*-irix[6789]*]) + [mips64*-*-* | mips*-mti-* | mips*-img-* | mips*-*-irix[6789]*]) abilist="n32 64 o32" cclist_n32="gcc cc" gcc_n32_cflags="$gcc_cflags -mabi=n32" cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations limb_n32=longlong - path_n32="mips64" cclist_64="gcc cc" gcc_64_cflags="$gcc_cflags -mabi=64" gcc_64_ldflags="-Wc,-mabi=64" cc_64_cflags="-O2 -64" # no -g, it disables all optimizations cc_64_ldflags="-Wc,-64" - path_64="mips64" + + case $host in + mips64r6 | mips*-img-*) + path_n32="mips64/mips64r6 mips64" + path_64="mips64/mips64r6 mips64" + ;; + *) + path_n32="mips64" + path_64="mips64" + ;; + esac ;; esac ;; diff -r 2ff56d3c5dfe mpn/mips32/mips32r6/addmul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips32/mips32r6/addmul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,104 @@ +dnl MIPS32 mpn_addmul_1 -- Multiply a limb vector with a single limb and add +dnl the product to a second limb vector. + +dnl Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_addmul_1) + +C feed-in phase 0 + lw $8,0($5) + +C feed-in phase 1 + addiu $5,$5,4 + mulu $11,$8,$7 + muhu $12,$8,$7 + + addiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + addiu $6,$6,-1 + beq $6,$0,$LC1 + lw $8,0($5) C load new s1 limb as early as possible + +Loop: lw $10,0($4) + move $3,$11 + move $9,$12 + addiu $5,$5,4 + addu $3,$3,$2 C add old carry limb to low product limb + mulu $11,$8,$7 + muhu $12,$8,$7 + lw $8,0($5) C load new s1 limb as early as possible + addiu $6,$6,-1 C decrement loop counter + sltu $2,$3,$2 C carry from previous addition -> $2 + addu $3,$10,$3 + sltu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + addiu $4,$4,4 + bne $6,$0,Loop + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: lw $10,0($4) + move $3,$11 + move $9,$12 + addu $3,$3,$2 + sltu $2,$3,$2 + mulu $11,$8,$7 + muhu $12,$8,$7 + addu $3,$10,$3 + sltu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + addiu $4,$4,4 + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: lw $10,0($4) + move $3,$11 + move $9,$12 + addu $3,$3,$2 + sltu $2,$3,$2 + addu $3,$10,$3 + sltu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + j $31 + addu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_addmul_1) diff -r 2ff56d3c5dfe mpn/mips32/mips32r6/mul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips32/mips32r6/mul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,92 @@ +dnl MIPS32 mpn_mul_1 -- Multiply a limb vector with a single limb and store +dnl the product in a second limb vector. + +dnl Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_mul_1) + +C feed-in phase 0 + lw $8,0($5) + +C feed-in phase 1 + addiu $5,$5,4 + mulu $11,$8,$7 + muhu $12,$8,$7 + + addiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + addiu $6,$6,-1 + beq $6,$0,$LC1 + lw $8,0($5) C load new s1 limb as early as possible + +Loop: move $10,$11 + move $9,$12 + addiu $5,$5,4 + addu $10,$10,$2 C add old carry limb to low product limb + mulu $11,$8,$7 + muhu $12,$8,$7 + lw $8,0($5) C load new s1 limb as early as possible + addiu $6,$6,-1 C decrement loop counter + sltu $2,$10,$2 C carry from previous addition -> $2 + sw $10,0($4) + addiu $4,$4,4 + bne $6,$0,Loop + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: move $10,$11 + move $9,$12 + addu $10,$10,$2 + sltu $2,$10,$2 + mulu $11,$8,$7 + muhu $12,$8,$7 + sw $10,0($4) + addiu $4,$4,4 + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: move $10,$11 + move $9,$12 + addu $10,$10,$2 + sltu $2,$10,$2 + sw $10,0($4) + j $31 + addu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_mul_1) diff -r 2ff56d3c5dfe mpn/mips32/mips32r6/submul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips32/mips32r6/submul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,104 @@ +dnl MIPS32 mpn_submul_1 -- Multiply a limb vector with a single limb and +dnl subtract the product from a second limb vector. + +dnl Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_submul_1) + +C feed-in phase 0 + lw $8,0($5) + +C feed-in phase 1 + addiu $5,$5,4 + mulu $11,$8,$7 + muhu $12,$8,$7 + + addiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + addiu $6,$6,-1 + beq $6,$0,$LC1 + lw $8,0($5) C load new s1 limb as early as possible + +Loop: lw $10,0($4) + move $3,$11 + move $9,$12 + addiu $5,$5,4 + addu $3,$3,$2 C add old carry limb to low product limb + mulu $11,$8,$7 + muhu $12,$8,$7 + lw $8,0($5) C load new s1 limb as early as possible + addiu $6,$6,-1 C decrement loop counter + sltu $2,$3,$2 C carry from previous addition -> $2 + subu $3,$10,$3 + sgtu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + addiu $4,$4,4 + bne $6,$0,Loop + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: lw $10,0($4) + move $3,$11 + move $9,$12 + addu $3,$3,$2 + sltu $2,$3,$2 + mulu $11,$8,$7 + muhu $12,$8,$7 + subu $3,$10,$3 + sgtu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + addiu $4,$4,4 + addu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: lw $10,0($4) + move $3,$11 + move $9,$12 + addu $3,$3,$2 + sltu $2,$3,$2 + subu $3,$10,$3 + sgtu $10,$3,$10 + addu $2,$2,$10 + sw $3,0($4) + j $31 + addu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_submul_1) diff -r 2ff56d3c5dfe mpn/mips32/mips32r6/umul.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips32/mips32r6/umul.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,44 @@ +dnl MIPS32 umul_ppmm -- longlong.h support. + +dnl Copyright 1999, 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C plp $4 +C u $5 +C v $6 + +ASM_START() +PROLOGUE(mpn_umul_ppmm) + mulu $3,$5,$6 + muhu $2,$5,$6 + j $31 + sw $3,0($4) +EPILOGUE(mpn_umul_ppmm) diff -r 2ff56d3c5dfe mpn/mips64/mips64r6/addmul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips64/mips64r6/addmul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,104 @@ +dnl MIPS64 mpn_addmul_1 -- Multiply a limb vector with a single limb and add +dnl the product to a second limb vector. + +dnl Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_addmul_1) + +C feed-in phase 0 + ld $8,0($5) + +C feed-in phase 1 + daddiu $5,$5,8 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + + daddiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + daddiu $6,$6,-1 + beq $6,$0,$LC1 + ld $8,0($5) C load new s1 limb as early as possible + +Loop: ld $10,0($4) + move $3,$11 + move $9,$12 + daddiu $5,$5,8 + daddu $3,$3,$2 C add old carry limb to low product limb + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + ld $8,0($5) C load new s1 limb as early as possible + daddiu $6,$6,-1 C decrement loop counter + sltu $2,$3,$2 C carry from previous addition -> $2 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + bne $6,$0,Loop + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: ld $10,0($4) + move $3,$11 + move $9,$12 + daddu $3,$3,$2 + sltu $2,$3,$2 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: ld $10,0($4) + move $3,$11 + move $9,$12 + daddu $3,$3,$2 + sltu $2,$3,$2 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + j $31 + daddu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_addmul_1) diff -r 2ff56d3c5dfe mpn/mips64/mips64r6/mul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips64/mips64r6/mul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,95 @@ +dnl MIPS64 mpn_mul_1 -- Multiply a limb vector with a single limb and store +dnl the product in a second limb vector. + +dnl Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_mul_1) + +C feed-in phase 0 + ld $8,0($5) + +C feed-in phase 1 + daddiu $5,$5,8 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + + daddiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + daddiu $6,$6,-1 + beq $6,$0,$LC1 + ld $8,0($5) C load new s1 limb as early as possible + +Loop: nop + move $10,$11 + move $9,$12 + daddiu $5,$5,8 + daddu $10,$10,$2 C add old carry limb to low product limb + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + ld $8,0($5) C load new s1 limb as early as possible + daddiu $6,$6,-1 C decrement loop counter + sltu $2,$10,$2 C carry from previous addition -> $2 + nop + nop + sd $10,0($4) + daddiu $4,$4,8 + bne $6,$0,Loop + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: move $10,$11 + move $9,$12 + daddu $10,$10,$2 + sltu $2,$10,$2 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + sd $10,0($4) + daddiu $4,$4,8 + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: move $10,$11 + move $9,$12 + daddu $10,$10,$2 + sltu $2,$10,$2 + sd $10,0($4) + j $31 + daddu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_mul_1) diff -r 2ff56d3c5dfe mpn/mips64/mips64r6/sqr_diagonal.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips64/mips64r6/sqr_diagonal.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,80 @@ +dnl MIPS64 mpn_sqr_diagonal. + +dnl Copyright 2001, 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + + +dnl INPUT PARAMETERS +dnl rp $4 +dnl up $5 +dnl n $6 + +include(`../config.m4') + +ASM_START() +PROLOGUE(mpn_sqr_diagonal) + ld r8,0(r5) + daddiu r6,r6,-2 + dmulu r11,r8,r8 + dmuhu r12,r8,r8 + bltz r6,$Lend1 + nop + ld r8,8(r5) + beq r6,r0,$Lend2 + nop + +$Loop: move r10,r11 + move r9,r12 + daddiu r6,r6,-1 + sd r10,0(r4) + sd r9,8(r4) + dmulu r11,r8,r8 + dmuhu r12,r8,r8 + ld r8,16(r5) + daddiu r5,r5,8 + bne r6,r0,$Loop + daddiu r4,r4,16 + +$Lend2: move r10,r11 + move r9,r12 + sd r10,0(r4) + sd r9,8(r4) + dmulu r11,r8,r8 + dmuhu r12,r8,r8 + move r10,r11 + move r9,r12 + sd r10,16(r4) + j r31 + sd r9,24(r4) + +$Lend1: move r10,r11 + move r9,r12 + sd r10,0(r4) + j r31 + sd r9,8(r4) +EPILOGUE(mpn_sqr_diagonal) diff -r 2ff56d3c5dfe mpn/mips64/mips64r6/submul_1.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips64/mips64r6/submul_1.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,104 @@ +dnl MIPS64 mpn_submul_1 -- Multiply a limb vector with a single limb and +dnl subtract the product from a second limb vector. + +dnl Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C res_ptr $4 +C s1_ptr $5 +C size $6 +C s2_limb $7 + +ASM_START() +PROLOGUE(mpn_submul_1) + +C feed-in phase 0 + ld $8,0($5) + +C feed-in phase 1 + daddiu $5,$5,8 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + + daddiu $6,$6,-1 + beq $6,$0,$LC0 + move $2,$0 C zero cy2 + + daddiu $6,$6,-1 + beq $6,$0,$LC1 + ld $8,0($5) C load new s1 limb as early as possible + +Loop: ld $10,0($4) + move $3,$11 + move $9,$12 + daddiu $5,$5,8 + daddu $3,$3,$2 C add old carry limb to low product limb + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + ld $8,0($5) C load new s1 limb as early as possible + daddiu $6,$6,-1 C decrement loop counter + sltu $2,$3,$2 C carry from previous addition -> $2 + dsubu $3,$10,$3 + sgtu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + bne $6,$0,Loop + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 1 +$LC1: ld $10,0($4) + move $3,$11 + move $9,$12 + daddu $3,$3,$2 + sltu $2,$3,$2 + dmulu $11,$8,$7 + dmuhu $12,$8,$7 + dsubu $3,$10,$3 + sgtu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + daddu $2,$9,$2 C add high product limb and carry from addition + +C wind-down phase 0 +$LC0: ld $10,0($4) + move $3,$11 + move $9,$12 + daddu $3,$3,$2 + sltu $2,$3,$2 + dsubu $3,$10,$3 + sgtu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + j $31 + daddu $2,$9,$2 C add high product limb and carry from addition +EPILOGUE(mpn_submul_1) diff -r 2ff56d3c5dfe mpn/mips64/mips64r6/umul.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpn/mips64/mips64r6/umul.asm Thu Feb 05 14:27:13 2015 -0800 @@ -0,0 +1,44 @@ +dnl MIPS64 umul_ppmm -- longlong.h support. + +dnl Copyright 2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C INPUT PARAMETERS +C plp $4 +C u $5 +C v $6 + +ASM_START() +PROLOGUE(mpn_umul_ppmm) + dmulu $3,$5,$6 + dmuhu $2,$5,$6 + j $31 + sd $3,0($4) +EPILOGUE(mpn_umul_ppmm)
_______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel