aboutsummaryrefslogtreecommitdiff
path: root/vendor/gmp-6.3.0/mpn/mips64/hilo
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-21 23:36:36 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-21 23:42:26 +0200
commita89a14ef5da44684a16b204e7a70460cc8c4922a (patch)
treeb23b4c6b155977909ef508fdae2f48d33d802813 /vendor/gmp-6.3.0/mpn/mips64/hilo
parent1db63fcedab0b288820d66e100b1877b1a5a8851 (diff)
Basic constant folding implementation
Diffstat (limited to 'vendor/gmp-6.3.0/mpn/mips64/hilo')
-rw-r--r--vendor/gmp-6.3.0/mpn/mips64/hilo/addmul_1.asm101
-rw-r--r--vendor/gmp-6.3.0/mpn/mips64/hilo/mul_1.asm92
-rw-r--r--vendor/gmp-6.3.0/mpn/mips64/hilo/sqr_diagonal.asm77
-rw-r--r--vendor/gmp-6.3.0/mpn/mips64/hilo/submul_1.asm101
-rw-r--r--vendor/gmp-6.3.0/mpn/mips64/hilo/umul.asm45
5 files changed, 416 insertions, 0 deletions
diff --git a/vendor/gmp-6.3.0/mpn/mips64/hilo/addmul_1.asm b/vendor/gmp-6.3.0/mpn/mips64/hilo/addmul_1.asm
new file mode 100644
index 0000000..8ff0976
--- /dev/null
+++ b/vendor/gmp-6.3.0/mpn/mips64/hilo/addmul_1.asm
@@ -0,0 +1,101 @@
+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
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ daddiu $5,$5,8
+ daddu $3,$3,$2 C add old carry limb to low product limb
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ daddu $3,$3,$2
+ sltu $2,$3,$2
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ 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 --git a/vendor/gmp-6.3.0/mpn/mips64/hilo/mul_1.asm b/vendor/gmp-6.3.0/mpn/mips64/hilo/mul_1.asm
new file mode 100644
index 0000000..77acf0a
--- /dev/null
+++ b/vendor/gmp-6.3.0/mpn/mips64/hilo/mul_1.asm
@@ -0,0 +1,92 @@
+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
+ dmultu $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
+ mflo $10
+ mfhi $9
+ daddiu $5,$5,8
+ daddu $10,$10,$2 C add old carry limb to low product limb
+ dmultu $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: mflo $10
+ mfhi $9
+ daddu $10,$10,$2
+ sltu $2,$10,$2
+ dmultu $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: mflo $10
+ mfhi $9
+ 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 --git a/vendor/gmp-6.3.0/mpn/mips64/hilo/sqr_diagonal.asm b/vendor/gmp-6.3.0/mpn/mips64/hilo/sqr_diagonal.asm
new file mode 100644
index 0000000..dcb87dc
--- /dev/null
+++ b/vendor/gmp-6.3.0/mpn/mips64/hilo/sqr_diagonal.asm
@@ -0,0 +1,77 @@
+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
+ dmultu r8,r8
+ bltz r6,$Lend1
+ nop
+ ld r8,8(r5)
+ beq r6,r0,$Lend2
+ nop
+
+$Loop: mflo r10
+ mfhi r9
+ daddiu r6,r6,-1
+ sd r10,0(r4)
+ sd r9,8(r4)
+ dmultu r8,r8
+ ld r8,16(r5)
+ daddiu r5,r5,8
+ bne r6,r0,$Loop
+ daddiu r4,r4,16
+
+$Lend2: mflo r10
+ mfhi r9
+ sd r10,0(r4)
+ sd r9,8(r4)
+ dmultu r8,r8
+ mflo r10
+ mfhi r9
+ sd r10,16(r4)
+ j r31
+ sd r9,24(r4)
+
+$Lend1: mflo r10
+ mfhi r9
+ sd r10,0(r4)
+ j r31
+ sd r9,8(r4)
+EPILOGUE(mpn_sqr_diagonal)
diff --git a/vendor/gmp-6.3.0/mpn/mips64/hilo/submul_1.asm b/vendor/gmp-6.3.0/mpn/mips64/hilo/submul_1.asm
new file mode 100644
index 0000000..089589c
--- /dev/null
+++ b/vendor/gmp-6.3.0/mpn/mips64/hilo/submul_1.asm
@@ -0,0 +1,101 @@
+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
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ daddiu $5,$5,8
+ daddu $3,$3,$2 C add old carry limb to low product limb
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ daddu $3,$3,$2
+ sltu $2,$3,$2
+ dmultu $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)
+ mflo $3
+ mfhi $9
+ 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 --git a/vendor/gmp-6.3.0/mpn/mips64/hilo/umul.asm b/vendor/gmp-6.3.0/mpn/mips64/hilo/umul.asm
new file mode 100644
index 0000000..b9aac57
--- /dev/null
+++ b/vendor/gmp-6.3.0/mpn/mips64/hilo/umul.asm
@@ -0,0 +1,45 @@
+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)
+ dmultu $5,$6
+ mflo $3
+ mfhi $2
+ j $31
+ sd $3,0($4)
+EPILOGUE(mpn_umul_ppmm)