summaryrefslogtreecommitdiff
path: root/mpn/sparc32
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2010-12-11 11:42:24 +0100
committerTorbjorn Granlund <tege@gmplib.org>2010-12-11 11:42:24 +0100
commit30d563aa2b52035d84f8e8629b909629977c0a4d (patch)
tree34bf912ace584370f50b66f62802e5ac0322ba52 /mpn/sparc32
parentab15841972351ebefe3bf4dcef38a07792755efb (diff)
downloadgmp-30d563aa2b52035d84f8e8629b909629977c0a4d.tar.gz
Add mpn/sparc32/ultrasparct1 with basic set of files.
Diffstat (limited to 'mpn/sparc32')
-rw-r--r--mpn/sparc32/ultrasparct1/add_n.asm59
-rw-r--r--mpn/sparc32/ultrasparct1/addmul_1.asm52
-rw-r--r--mpn/sparc32/ultrasparct1/mul_1.asm50
-rw-r--r--mpn/sparc32/ultrasparct1/sqr_diagonal.asm44
-rw-r--r--mpn/sparc32/ultrasparct1/sub_n.asm59
-rw-r--r--mpn/sparc32/ultrasparct1/submul_1.asm52
6 files changed, 316 insertions, 0 deletions
diff --git a/mpn/sparc32/ultrasparct1/add_n.asm b/mpn/sparc32/ultrasparct1/add_n.asm
new file mode 100644
index 000000000..7fd21a6a7
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/add_n.asm
@@ -0,0 +1,59 @@
+dnl SPARC T1 32-bit mpn_add_n.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', %o0)
+define(`ap', %o1)
+define(`bp', %o2)
+define(`n', %o3)
+define(`cy', %o4)
+
+define(`i', %o3)
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc)
+
+ASM_START()
+PROLOGUE(mpn_add_nc)
+ b L(ent)
+ srl cy, 0, cy C strip any bogus high bits
+EPILOGUE()
+
+PROLOGUE(mpn_add_n)
+ mov 0, cy
+L(ent): srl n, 0, n C strip any bogus high bits
+ sll n, 2, n
+ add ap, n, ap
+ add bp, n, bp
+ add rp, n, rp
+ neg n, i
+
+L(top): lduw [ap+i], %g1
+ lduw [bp+i], %g2
+ add %g1, %g2, %g3
+ add %g3, cy, %g3
+ stw %g3, [rp+i]
+ add i, 4, i
+ brnz i, L(top)
+ srlx %g3, 32, cy
+
+ retl
+ mov cy, %o0 C return value
+EPILOGUE()
diff --git a/mpn/sparc32/ultrasparct1/addmul_1.asm b/mpn/sparc32/ultrasparct1/addmul_1.asm
new file mode 100644
index 000000000..50017261c
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/addmul_1.asm
@@ -0,0 +1,52 @@
+dnl SPARC T1 32-bit mpn_addmul_1.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C cycles/limb
+C UltraSPARC T1: 27
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`n', `%o2')
+define(`v0', `%o3')
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+ mov 0, %g4
+ srl v0, 0, v0
+ srl n, 0, n
+ dec n C n--
+
+L(top): lduw [up+0], %g1
+ add up, 4, up C up++
+ mulx %g1, v0, %g3
+ lduw [rp+0], %g2
+ add %g2, %g3, %g3
+ add %g4, %g3, %g3
+ stw %g3, [rp+0]
+ add rp, 4, rp C rp++
+ srlx %g3, 32, %g4
+ brnz n, L(top)
+ dec n C n--
+
+ retl
+ mov %g4, %o0 C return value
+EPILOGUE()
diff --git a/mpn/sparc32/ultrasparct1/mul_1.asm b/mpn/sparc32/ultrasparct1/mul_1.asm
new file mode 100644
index 000000000..fcde0c788
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/mul_1.asm
@@ -0,0 +1,50 @@
+dnl SPARC T1 32-bit mpn_mul_1.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C cycles/limb
+C UltraSPARC T1: 23
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`n', `%o2')
+define(`v0', `%o3')
+
+ASM_START()
+PROLOGUE(mpn_mul_1)
+ mov 0, %g4
+ srl v0, 0, v0
+ srl n, 0, n
+ dec n C n--
+
+L(top): lduw [up+0], %g1
+ add up, 4, up C up++
+ mulx %g1, v0, %g3
+ add %g4, %g3, %g3
+ stw %g3, [rp+0]
+ add rp, 4, rp C rp++
+ srlx %g3, 32, %g4
+ brnz n, L(top)
+ dec n C n--
+
+ retl
+ mov %g4, %o0 C return value
+EPILOGUE()
diff --git a/mpn/sparc32/ultrasparct1/sqr_diagonal.asm b/mpn/sparc32/ultrasparct1/sqr_diagonal.asm
new file mode 100644
index 000000000..c7aa966a7
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/sqr_diagonal.asm
@@ -0,0 +1,44 @@
+dnl SPARC T1 32-bit mpn_sqr_diagonal.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`n', `%o2')
+
+ASM_START()
+PROLOGUE(mpn_sqr_diagonal)
+ deccc n C n--
+ nop
+
+L(top): lduw [up+0], %g1
+ add up, 4, up C up++
+ mulx %g1, %g1, %g3
+ stw %g3, [rp+0]
+ srlx %g3, 32, %g4
+ stw %g4, [rp+4]
+ add rp, 8, rp C rp += 2
+ bnz %icc, L(top)
+ deccc n C n--
+
+ retl
+ nop
+EPILOGUE()
diff --git a/mpn/sparc32/ultrasparct1/sub_n.asm b/mpn/sparc32/ultrasparct1/sub_n.asm
new file mode 100644
index 000000000..a2293a988
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/sub_n.asm
@@ -0,0 +1,59 @@
+dnl SPARC T1 32-bit mpn_sub_n.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C INPUT PARAMETERS
+define(`rp', %o0)
+define(`ap', %o1)
+define(`bp', %o2)
+define(`n', %o3)
+define(`cy', %o4)
+
+define(`i', %o3)
+
+MULFUNC_PROLOGUE(mpn_sub_n mpn_sub_nc)
+
+ASM_START()
+PROLOGUE(mpn_sub_nc)
+ b L(ent)
+ srl cy, 0, cy C strip any bogus high bits
+EPILOGUE()
+
+PROLOGUE(mpn_sub_n)
+ mov 0, cy
+L(ent): srl n, 0, n C strip any bogus high bits
+ sll n, 2, n
+ add ap, n, ap
+ add bp, n, bp
+ add rp, n, rp
+ neg n, i
+
+L(top): lduw [ap+i], %g1
+ lduw [bp+i], %g2
+ sub %g1, %g2, %g3
+ sub %g3, cy, %g3
+ stw %g3, [rp+i]
+ add i, 4, i
+ brnz i, L(top)
+ srlx %g3, 63, cy
+
+ retl
+ mov cy, %o0 C return value
+EPILOGUE()
diff --git a/mpn/sparc32/ultrasparct1/submul_1.asm b/mpn/sparc32/ultrasparct1/submul_1.asm
new file mode 100644
index 000000000..605a8820b
--- /dev/null
+++ b/mpn/sparc32/ultrasparct1/submul_1.asm
@@ -0,0 +1,52 @@
+dnl SPARC T1 32-bit mpn_submul_1.
+
+dnl Copyright 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+
+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 Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C cycles/limb
+C UltraSPARC T1: 27
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`n', `%o2')
+define(`v0', `%o3')
+
+ASM_START()
+PROLOGUE(mpn_submul_1)
+ subcc %g0, %g0, %g4 C clear CF and g4
+ srl v0, 0, v0
+ srl n, 0, n
+ dec n C n--
+
+L(top): lduw [up+0], %g1
+ add up, 4, up C up++
+ mulx %g1, v0, %g3
+ lduw [rp+0], %g2
+ addx %g4, %g3, %g3
+ srlx %g3, 32, %g4
+ subcc %g2, %g3, %g3
+ stw %g3, [rp+0]
+ add rp, 4, rp C rp++
+ brnz n, L(top)
+ dec n C n--
+
+ retl
+ addx %g4, 0, %o0 C return value
+EPILOGUE()