[Gmp-commit] /var/hg/gmp: Major Utrasparc T3/T4 improvements.
mercurial at gmplib.org
mercurial at gmplib.org
Wed Mar 6 12:33:43 CET 2013
details: /var/hg/gmp/rev/84dd2a40a886
changeset: 15528:84dd2a40a886
user: David Miller
date: Wed Mar 06 12:33:38 2013 +0100
description:
Major Utrasparc T3/T4 improvements.
diffstat:
ChangeLog | 13 ++++-
config.guess | 2 +
configure.ac | 19 +++++++-
mpn/sparc64/ultrasparct3/add_n.asm | 73 ++++++++++++++++++++++++++++++
mpn/sparc64/ultrasparct3/addmul_1.asm | 80 +++++++++++++++++++++++++++++++++
mpn/sparc64/ultrasparct3/mul_1.asm | 70 +++++++++++++++++++++++++++++
mpn/sparc64/ultrasparct3/sub_n.asm | 77 ++++++++++++++++++++++++++++++++
mpn/sparc64/ultrasparct3/submul_1.asm | 83 +++++++++++++++++++++++++++++++++++
8 files changed, 413 insertions(+), 4 deletions(-)
diffs (truncated from 494 to 300 lines):
diff -r dff8f0d02b13 -r 84dd2a40a886 ChangeLog
--- a/ChangeLog Tue Mar 05 13:47:00 2013 +0100
+++ b/ChangeLog Wed Mar 06 12:33:38 2013 +0100
@@ -1,5 +1,14 @@
-2013-03-05 David Miller <davem at davemloft.net>
-
+2013-03-06 David Miller <davem at davemloft.net>
+
+ * config.guess: Recognize UltraSparc T4 under Linux.
+ * configure.ac: Add sparc64/ultrasparct3 to path_64 when T3 or T4.
+ Append -xarch=v8plusd or -xarch=v9d to command line, as needed.
+ * mpn/sparc64/ultrasparct3/mul_1.asm: New file.
+ * mpn/sparc64/ultrasparct3/addmul_1.asm: New file.
+ * mpn/sparc64/ultrasparct3/submul_1.asm: New file.
+ * mpn/sparc64/ultrasparct3/add_n.asm: New file.
+ * mpn/sparc64/ultrasparct3/sub_n.asm: New file.
+
* mpn/sparc32/ultrasparct1/mul_1.asm: Unroll main loop one time, add
T2/T3/T4 timings.
* mpn/sparc32/ultrasparct1/addmul_1.asm: Likewise.
diff -r dff8f0d02b13 -r 84dd2a40a886 config.guess
--- a/config.guess Tue Mar 05 13:47:00 2013 +0100
+++ b/config.guess Wed Mar 06 12:33:38 2013 +0100
@@ -581,6 +581,8 @@
elif grep 'cpu.*MB86904' /proc/cpuinfo >/dev/null; then
# actually MicroSPARC-II
exact_cpu=microsparc
+ elif grep 'cpu.*UltraSparc T4' /proc/cpuinfo >/dev/null; then
+ exact_cpu="ultrasparct4"
elif grep 'cpu.*UltraSparc T3' /proc/cpuinfo >/dev/null; then
exact_cpu="ultrasparct3"
elif grep 'cpu.*UltraSparc T2' /proc/cpuinfo >/dev/null; then
diff -r dff8f0d02b13 -r 84dd2a40a886 configure.ac
--- a/configure.ac Tue Mar 05 13:47:00 2013 +0100
+++ b/configure.ac Wed Mar 06 12:33:38 2013 +0100
@@ -1284,6 +1284,8 @@
# abilist="64" only.
#
case $host_cpu in
+ [ultrasparct[34]])
+ gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plusd" ;;
sparc64 | sparcv9* | ultrasparc*)
gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
esac
@@ -1324,6 +1326,7 @@
case $host_cpu in
sparcv8 | microsparc | supersparc | turbosparc)
cc_cflags_arch="-xarch=v8" ;;
+ [ultrasparct[34]]) cc_cflags_arch="-xarch=v8plusd" ;;
sparc64 | sparcv9* | ultrasparc*) cc_cflags_arch="-xarch=v8plus" ;;
*) cc_cflags_arch="-xarch=v7" ;;
esac
@@ -1380,8 +1383,10 @@
path_64="sparc64/ultrasparc1234 sparc64" ;;
[ultrasparc[34]])
path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
- [ultrasparct[1234]])
+ [ultrasparct[12]])
path_64="sparc64/ultrasparct1 sparc64" ;;
+ [ultrasparct[34]])
+ path_64="sparc64/ultrasparct3 sparc64/ultrasparct1 sparc64" ;;
*)
path_64="sparc64"
esac
@@ -1404,6 +1409,11 @@
gcc_64_ldflags="-Wc,-m64"
gcc_64_cflags_optlist="cpu"
+ case $host_cpu in
+ [ultrasparct[34]])
+ gcc_64_cflags="$gcc_64_cflags -Wa,-xarch=v9d" ;;
+ esac
+
case $host in
*-*-solaris*)
# Sun cc.
@@ -1413,8 +1423,13 @@
# -fast is documented as miscompiling things for the sake of speed.
#
cclist_64="$cclist_64 cc"
- cc_64_cflags="-xO3 -xarch=v9"
cc_64_cflags_optlist="cpu"
+ case $host_cpu in
+ [ultrasparct[34]])
+ cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;;
+ *)
+ cc_64_cflags="-xO3 -xarch=v9" ;;
+ esac
;;
esac
diff -r dff8f0d02b13 -r 84dd2a40a886 mpn/sparc64/ultrasparct3/add_n.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/sparc64/ultrasparct3/add_n.asm Wed Mar 06 12:33:38 2013 +0100
@@ -0,0 +1,73 @@
+dnl SPARC v9 mpn_add_n for T3/T4.
+
+dnl Copyright 2013 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 T3: 9
+C UltraSPARC T4: 3.5
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`vp', `%o2')
+define(`n', `%o3')
+define(`cy', `%o4')
+
+ASM_START()
+ REGISTER(%g2,#scratch)
+ REGISTER(%g3,#scratch)
+ ALIGN(32)
+PROLOGUE(mpn_add_nc)
+ b,a L(ent)
+EPILOGUE()
+PROLOGUE(mpn_add_n)
+ mov 0, cy
+L(ent):
+ subcc n, 1, n
+ be L(final_one)
+ cmp %g0, cy
+L(top):
+ ldx [up+0], %o4
+ add up, 16, up
+ ldx [vp+0], %o5
+ add vp, 16, vp
+ ldx [up-8], %g1
+ add rp, 16, rp
+ ldx [vp-8], %g2
+ sub n, 2, n
+ addxccc %o4, %o5, %g3
+ stx %g3, [rp-16]
+ addxccc %g1, %g2, %g2
+ brgz n, L(top)
+ stx %g2, [rp-8]
+
+ brlz,pt n, L(done)
+ nop
+
+L(final_one):
+ ldx [up+0], %o4
+ ldx [vp+0], %o5
+ addxccc %o4, %o5, %g3
+ stx %g3, [rp+0]
+
+L(done):
+ retl
+ addxc %g0, %g0, %o0
+EPILOGUE()
diff -r dff8f0d02b13 -r 84dd2a40a886 mpn/sparc64/ultrasparct3/addmul_1.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/sparc64/ultrasparct3/addmul_1.asm Wed Mar 06 12:33:38 2013 +0100
@@ -0,0 +1,80 @@
+dnl SPARC v9 mpn_addmul_1 for T3/T4.
+
+dnl Copyright 2013 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 T3: 28
+C UltraSPARC T4: 5.5
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n', `%i2')
+define(`v0', `%i3')
+
+ASM_START()
+ REGISTER(%g2,#scratch)
+ REGISTER(%g3,#scratch)
+ ALIGN(32)
+PROLOGUE(mpn_addmul_1)
+ save %sp, -176, %sp
+ subcc n, 1, n
+ be L(final_one)
+ subcc %g0, %g0, %o5
+
+L(top):
+ ldx [up+0], %l0
+ ldx [up+8], %l1
+ ldx [rp+0], %l2
+ ldx [rp+8], %l3
+ mulx %l0, v0, %o0
+ add up, 16, up
+ umulxhi %l0, v0, %o1
+ add rp, 16, rp
+ mulx %l1, v0, %o2
+ sub n, 2, n
+ umulxhi %l1, v0, %o3
+ addxccc %o0, %o5, %o0
+ addxccc %o2, %o1, %o2
+ addxc %g0, %o3, %o5
+ addcc %o0, %l2, %o0
+ stx %o0, [rp-16]
+ addxccc %o2, %l3, %o2
+ brgz n, L(top)
+ stx %o2, [rp-8]
+
+ brlz,pt n, L(done)
+ nop
+
+L(final_one):
+ ldx [up+0], %l0
+ ldx [rp+0], %l2
+ mulx %l0, v0, %o0
+ umulxhi %l0, v0, %o1
+ addxccc %o5, %o0, %o0
+ addxc %g0, %o1, %o5
+ addcc %l2, %o0, %o0
+ stx %o0, [rp+0]
+
+L(done):
+ addxc %g0, %o5, %o5
+ ret
+ restore %o5, 0, %o0
+EPILOGUE()
diff -r dff8f0d02b13 -r 84dd2a40a886 mpn/sparc64/ultrasparct3/mul_1.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/sparc64/ultrasparct3/mul_1.asm Wed Mar 06 12:33:38 2013 +0100
@@ -0,0 +1,70 @@
+dnl SPARC v9 mpn_mul_1 for T3/T4.
+
+dnl Copyright 2013 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 T3: 25.5
+C UltraSPARC T4: 3.8
+
+C INPUT PARAMETERS
+define(`rp', `%o0')
+define(`up', `%o1')
+define(`n', `%o2')
+define(`v0', `%o3')
+
+ASM_START()
+ REGISTER(%g2,#scratch)
+ REGISTER(%g3,#scratch)
+ ALIGN(32)
+PROLOGUE(mpn_mul_1)
+ subcc n, 1, n
+ be L(final_one)
+ subcc %g0, %g0, %o5
+
+L(top):
+ ldx [up+0], %g1
+ sub n, 2, n
+ ldx [up+8], %o4
More information about the gmp-commit
mailing list