summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Miller <devnull@localhost>2013-03-06 12:33:38 +0100
committerDavid Miller <devnull@localhost>2013-03-06 12:33:38 +0100
commit3f96080a0ea23db7dfaec7c5b923e49f949e61db (patch)
treebe385a4387c0fd5d8a5f48e040eafd9e650f30ba
parentf48dc0296a0cde8f0d5b5416fe286b06c15c65f6 (diff)
downloadgmp-3f96080a0ea23db7dfaec7c5b923e49f949e61db.tar.gz
Major Utrasparc T3/T4 improvements.
-rw-r--r--ChangeLog13
-rwxr-xr-xconfig.guess2
-rw-r--r--configure.ac19
-rw-r--r--mpn/sparc64/ultrasparct3/add_n.asm73
-rw-r--r--mpn/sparc64/ultrasparct3/addmul_1.asm80
-rw-r--r--mpn/sparc64/ultrasparct3/mul_1.asm70
-rw-r--r--mpn/sparc64/ultrasparct3/sub_n.asm77
-rw-r--r--mpn/sparc64/ultrasparct3/submul_1.asm83
8 files changed, 413 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ea0c9ec4..fed805536 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
-2013-03-05 David Miller <davem@davemloft.net>
-
+2013-03-06 David Miller <davem@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 --git a/config.guess b/config.guess
index 7147bf6dd..bcd1d89f9 100755
--- a/config.guess
+++ b/config.guess
@@ -581,6 +581,8 @@ sparc-*-* | sparc64-*-*)
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 --git a/configure.ac b/configure.ac
index 189363ff0..3559056b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1284,6 +1284,8 @@ case $host in
# 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 in
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 @@ case $host in
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 @@ case $host in
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 @@ case $host in
# -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 --git a/mpn/sparc64/ultrasparct3/add_n.asm b/mpn/sparc64/ultrasparct3/add_n.asm
new file mode 100644
index 000000000..16bd0c45e
--- /dev/null
+++ b/mpn/sparc64/ultrasparct3/add_n.asm
@@ -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 --git a/mpn/sparc64/ultrasparct3/addmul_1.asm b/mpn/sparc64/ultrasparct3/addmul_1.asm
new file mode 100644
index 000000000..98a9fe4a4
--- /dev/null
+++ b/mpn/sparc64/ultrasparct3/addmul_1.asm
@@ -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 --git a/mpn/sparc64/ultrasparct3/mul_1.asm b/mpn/sparc64/ultrasparct3/mul_1.asm
new file mode 100644
index 000000000..55cb8d877
--- /dev/null
+++ b/mpn/sparc64/ultrasparct3/mul_1.asm
@@ -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
+ mulx %g1, v0, %g3
+ add up, 16, up
+ umulxhi %g1, v0, %g2
+ mulx %o4, v0, %g1
+ add rp, 16, rp
+ addxccc %g3, %o5, %g3
+ umulxhi %o4, v0, %o5
+ stx %g3, [rp-16]
+ addxccc %g1, %g2, %g1
+ brgz n, L(top)
+ stx %g1, [rp-8]
+
+ brlz,pt n, L(done)
+ nop
+
+L(final_one):
+ ldx [up+0], %g1
+ mulx %g1, v0, %g3
+ addxccc %g3, %o5, %g3
+ umulxhi %g1, v0, %o5
+ stx %g3, [rp+0]
+
+L(done):
+ retl
+ addxc %g0, %o5, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/sub_n.asm b/mpn/sparc64/ultrasparct3/sub_n.asm
new file mode 100644
index 000000000..7ac290a5d
--- /dev/null
+++ b/mpn/sparc64/ultrasparct3/sub_n.asm
@@ -0,0 +1,77 @@
+dnl SPARC v9 mpn_sub_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: 10
+C UltraSPARC T4: 4
+
+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)
+PROLOGUE(mpn_sub_nc)
+ ba,pt %xcc, L(ent)
+ xor cy, 1, cy
+EPILOGUE()
+PROLOGUE(mpn_sub_n)
+ mov 1, cy
+L(ent):
+ subcc n, 1, n
+ be L(final_one)
+ cmp %g0, cy
+L(top):
+ ldx [vp+0], %o5
+ add vp, 16, vp
+ ldx [up+0], %o4
+ add up, 16, up
+ ldx [vp-8], %g2
+ sub n, 2, n
+ ldx [up-8], %g1
+ add rp, 16, rp
+ xnor %o5, %g0, %o5
+ addxccc %o4, %o5, %g3
+ stx %g3, [rp-16]
+ xnor %g2, %g0, %g2
+ 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
+ xnor %o5, %g0, %o5
+ addxccc %o4, %o5, %g3
+ stx %g3, [rp+0]
+
+L(done):
+ clr %o0
+ retl
+ movcc %xcc, 1, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/submul_1.asm b/mpn/sparc64/ultrasparct3/submul_1.asm
new file mode 100644
index 000000000..fb7abb2d0
--- /dev/null
+++ b/mpn/sparc64/ultrasparct3/submul_1.asm
@@ -0,0 +1,83 @@
+dnl SPARC v9 mpn_submul_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: 29.5
+C UltraSPARC T4: 6.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_submul_1)
+ save %sp, -176, %sp
+ subcc n, 1, n
+ be L(final_one)
+ clr %o5
+
+L(top):
+ ldx [up+0], %l0
+ ldx [rp+0], %l2
+ ldx [up+8], %l1
+ 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
+ addcc %o5, %o0, %o0
+ addxc %g0, %o1, %o5
+ subcc %l2, %o0, %o0
+ addxc %g0, %o5, %o5
+ stx %o0, [rp-16]
+ addcc %o5, %o2, %o2
+ addxc %g0, %o3, %o5
+ subcc %l3, %o2, %o2
+ addxc %g0, %o5, %o5
+ 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
+ addcc %o5, %o0, %o0
+ addxc %g0, %o1, %o5
+ subcc %l2, %o0, %o0
+ addxc %g0, %o5, %o5
+ stx %o0, [rp+0]
+
+L(done):
+ ret
+ restore %o5, 0, %o0
+EPILOGUE()