From f7062b9a6f8ccaeb080b6c819ceec59b77cce3c4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 15 Mar 2012 02:13:54 -0700 Subject: Sparc optimized fmin{,f} and fmax{,f}. * sysdeps/sparc/sparc64/fpu/s_fmax.S: New file. * sysdeps/sparc/sparc64/fpu/s_fmaxf.S: New file. * sysdeps/sparc/sparc64/fpu/s_fmin.S: New file. * sysdeps/sparc/sparc64/fpu/s_fminf.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fmax.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fmaxf.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fmin.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/s_fminf.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmax.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaxf.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmin.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf-vis3.S: New file. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fminf.S: New file. * sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Add new vis3 fmin/fmax sysdep routines. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile: Likewise. --- sysdeps/sparc/sparc64/fpu/multiarch/Makefile | 3 +- sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S | 26 ++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S | 46 ++++++++++++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S | 27 +++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S | 46 ++++++++++++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S | 26 ++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S | 46 ++++++++++++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S | 27 +++++++++++++ sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S | 46 ++++++++++++++++++++++ sysdeps/sparc/sparc64/fpu/s_fmax.S | 36 +++++++++++++++++ sysdeps/sparc/sparc64/fpu/s_fmaxf.S | 36 +++++++++++++++++ sysdeps/sparc/sparc64/fpu/s_fmin.S | 36 +++++++++++++++++ sysdeps/sparc/sparc64/fpu/s_fminf.S | 36 +++++++++++++++++ 13 files changed, 436 insertions(+), 1 deletion(-) create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S create mode 100644 sysdeps/sparc/sparc64/fpu/s_fmax.S create mode 100644 sysdeps/sparc/sparc64/fpu/s_fmaxf.S create mode 100644 sysdeps/sparc/sparc64/fpu/s_fmin.S create mode 100644 sysdeps/sparc/sparc64/fpu/s_fminf.S (limited to 'sysdeps/sparc/sparc64') diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile index 564ed26c3d..0aa40464e0 100644 --- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile +++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile @@ -5,7 +5,8 @@ libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 s_ceilf-vis3 \ s_floorf-vis3 s_floor-vis3 m_isinff-vis3 \ m_isinf-vis3 m_isnanf-vis3 m_isnan-vis3 \ s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 \ - s_rint-vis3 + s_rint-vis3 s_fminf-vis3 s_fmin-vis3 \ + s_fmaxf-vis3 s_fmax-vis3 sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \ s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \ s_isnanf-vis3 s_isnan-vis3 diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S new file mode 100644 index 0000000000..777bb6eee9 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax-vis3.S @@ -0,0 +1,26 @@ +/* fmax function, sparc64 vis3 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY (__fmax_vis3) + flcmpd %fcc1, %f0, %f2 + retl + fmovdlg %fcc1, %f2, %f0 +END (__fmax_vis3) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S new file mode 100644 index 0000000000..f604f5b533 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmax.S @@ -0,0 +1,46 @@ +#include + + .text +ENTRY(__fmax) + .type __fmax, @gnu_indirect_function +# ifdef SHARED + SETUP_PIC_REG_LEAF(o3, o5) +# endif +# ifdef HAVE_AS_VIS3_SUPPORT + set HWCAP_SPARC_VIS3, %o1 + andcc %o0, %o1, %g0 + be 9f + nop +# ifdef SHARED + sethi %gdop_hix22(__fmax_vis3), %o1 + xor %o1, %gdop_lox10(__fmax_vis3), %o1 +# else + set __fmax_vis3, %o1 +# endif + ba 10f + nop +9: +# endif +# ifdef SHARED + sethi %gdop_hix22(__fmax_generic), %o1 + xor %o1, %gdop_lox10(__fmax_generic), %o1 +# else + set __fmax_generic, %o1 +# endif +# ifdef HAVE_AS_VIS3_SUPPORT +10: +# endif +# ifdef SHARED + add %o3, %o1, %o1 +# endif + retl + mov %o1, %o0 +END(__fmax) +weak_alias (__fmax, fmax) + +# undef weak_alias +# define weak_alias(a, b) + +#define __fmax __fmax_generic + +#include "../s_fmax.S" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S new file mode 100644 index 0000000000..b3f2e85cd3 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf-vis3.S @@ -0,0 +1,27 @@ +/* fmaxf function, sparc64 vis3 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY (__fmaxf_vis3) + flcmps %fcc1, %f1, %f3 + fmovs %f1, %f0 + retl + fmovslg %fcc1, %f3, %f0 +END (__fmaxf_vis3) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S new file mode 100644 index 0000000000..c188f8e568 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaxf.S @@ -0,0 +1,46 @@ +#include + + .text +ENTRY(__fmaxf) + .type __fmaxf, @gnu_indirect_function +# ifdef SHARED + SETUP_PIC_REG_LEAF(o3, o5) +# endif +# ifdef HAVE_AS_VIS3_SUPPORT + set HWCAP_SPARC_VIS3, %o1 + andcc %o0, %o1, %g0 + be 9f + nop +# ifdef SHARED + sethi %gdop_hix22(__fmaxf_vis3), %o1 + xor %o1, %gdop_lox10(__fmaxf_vis3), %o1 +# else + set __fmaxf_vis3, %o1 +# endif + ba 10f + nop +9: +# endif +# ifdef SHARED + sethi %gdop_hix22(__fmaxf_generic), %o1 + xor %o1, %gdop_lox10(__fmaxf_generic), %o1 +# else + set __fmaxf_generic, %o1 +# endif +# ifdef HAVE_AS_VIS3_SUPPORT +10: +# endif +# ifdef SHARED + add %o3, %o1, %o1 +# endif + retl + mov %o1, %o0 +END(__fmaxf) +weak_alias (__fmaxf, fmaxf) + +# undef weak_alias +# define weak_alias(a, b) + +#define __fmaxf __fmaxf_generic + +#include "../s_fmaxf.S" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S new file mode 100644 index 0000000000..edb5823b41 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin-vis3.S @@ -0,0 +1,26 @@ +/* fmin function, sparc64 vis3 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY (__fmin_vis3) + flcmpd %fcc1, %f0, %f2 + retl + fmovdge %fcc1, %f2, %f0 +END (__fmin_vis3) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S new file mode 100644 index 0000000000..ed7018b58b --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmin.S @@ -0,0 +1,46 @@ +#include + + .text +ENTRY(__fmin) + .type __fmin, @gnu_indirect_function +# ifdef SHARED + SETUP_PIC_REG_LEAF(o3, o5) +# endif +# ifdef HAVE_AS_VIS3_SUPPORT + set HWCAP_SPARC_VIS3, %o1 + andcc %o0, %o1, %g0 + be 9f + nop +# ifdef SHARED + sethi %gdop_hix22(__fmin_vis3), %o1 + xor %o1, %gdop_lox10(__fmin_vis3), %o1 +# else + set __fmin_vis3, %o1 +# endif + ba 10f + nop +9: +# endif +# ifdef SHARED + sethi %gdop_hix22(__fmin_generic), %o1 + xor %o1, %gdop_lox10(__fmin_generic), %o1 +# else + set __fmin_generic, %o1 +# endif +# ifdef HAVE_AS_VIS3_SUPPORT +10: +# endif +# ifdef SHARED + add %o3, %o1, %o1 +# endif + retl + mov %o1, %o0 +END(__fmin) +weak_alias (__fmin, fmin) + +# undef weak_alias +# define weak_alias(a, b) + +#define __fmin __fmin_generic + +#include "../s_fmin.S" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S new file mode 100644 index 0000000000..81d5fb1781 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf-vis3.S @@ -0,0 +1,27 @@ +/* fminf function, sparc64 vis3 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY (__fminf_vis3) + flcmps %fcc1, %f1, %f3 + fmovs %f1, %f0 + retl + fmovsge %fcc1, %f3, %f0 +END (__fminf_vis3) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S new file mode 100644 index 0000000000..6c7a4928c1 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fminf.S @@ -0,0 +1,46 @@ +#include + + .text +ENTRY(__fminf) + .type __fminf, @gnu_indirect_function +# ifdef SHARED + SETUP_PIC_REG_LEAF(o3, o5) +# endif +# ifdef HAVE_AS_VIS3_SUPPORT + set HWCAP_SPARC_VIS3, %o1 + andcc %o0, %o1, %g0 + be 9f + nop +# ifdef SHARED + sethi %gdop_hix22(__fminf_vis3), %o1 + xor %o1, %gdop_lox10(__fminf_vis3), %o1 +# else + set __fminf_vis3, %o1 +# endif + ba 10f + nop +9: +# endif +# ifdef SHARED + sethi %gdop_hix22(__fminf_generic), %o1 + xor %o1, %gdop_lox10(__fminf_generic), %o1 +# else + set __fminf_generic, %o1 +# endif +# ifdef HAVE_AS_VIS3_SUPPORT +10: +# endif +# ifdef SHARED + add %o3, %o1, %o1 +# endif + retl + mov %o1, %o0 +END(__fminf) +weak_alias (__fminf, fminf) + +# undef weak_alias +# define weak_alias(a, b) + +#define __fminf __fminf_generic + +#include "../s_fminf.S" diff --git a/sysdeps/sparc/sparc64/fpu/s_fmax.S b/sysdeps/sparc/sparc64/fpu/s_fmax.S new file mode 100644 index 0000000000..21a2c80958 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_fmax.S @@ -0,0 +1,36 @@ +/* fmax function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__fmax) + fcmpd %fcc1, %f2, %f2 + fzero SIGN_BIT + fmovdu %fcc1, %f0, %f2 + fnegd SIGN_BIT, SIGN_BIT + fcmpd %fcc2, %f0, %f2 + fmovdul %fcc2, %f2, %f0 + fand %f0, %f2, %f4 + fandnot2 SIGN_BIT, %f4, %f4 + retl + fandnot2 %f0, %f4, %f0 +END (__fmax) +weak_alias (__fmax, fmax) diff --git a/sysdeps/sparc/sparc64/fpu/s_fmaxf.S b/sysdeps/sparc/sparc64/fpu/s_fmaxf.S new file mode 100644 index 0000000000..989c5c300d --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_fmaxf.S @@ -0,0 +1,36 @@ +/* fmaxf function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__fmaxf) + fcmps %fcc1, %f3, %f3 + fzeros SIGN_BIT + fmovsu %fcc1, %f1, %f3 + fnegs SIGN_BIT, SIGN_BIT + fcmps %fcc2, %f1, %f3 + fmovsul %fcc2, %f3, %f1 + fands %f1, %f3, %f4 + fandnot2s SIGN_BIT, %f4, %f4 + retl + fandnot2s %f1, %f4, %f0 +END (__fmaxf) +weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/sparc/sparc64/fpu/s_fmin.S b/sysdeps/sparc/sparc64/fpu/s_fmin.S new file mode 100644 index 0000000000..01105e6972 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_fmin.S @@ -0,0 +1,36 @@ +/* fmin function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__fmin) + fcmpd %fcc1, %f2, %f2 + fzero SIGN_BIT + fmovdu %fcc1, %f0, %f2 + fnegd SIGN_BIT, SIGN_BIT + fcmpd %fcc2, %f0, %f2 + fmovdug %fcc2, %f2, %f0 + for %f0, %f2, %f4 + fand %f4, SIGN_BIT, %f4 + retl + for %f0, %f4, %f0 +END (__fmin) +weak_alias (__fmin, fmin) diff --git a/sysdeps/sparc/sparc64/fpu/s_fminf.S b/sysdeps/sparc/sparc64/fpu/s_fminf.S new file mode 100644 index 0000000000..13a0ef40e1 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/s_fminf.S @@ -0,0 +1,36 @@ +/* fminf function, sparc64 version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David S. Miller , 2012. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#define SIGN_BIT %f12 /* -0.0 */ + +ENTRY (__fminf) + fcmps %fcc1, %f3, %f3 + fzeros SIGN_BIT + fmovsu %fcc1, %f1, %f3 + fnegs SIGN_BIT, SIGN_BIT + fcmps %fcc2, %f1, %f3 + fmovsug %fcc2, %f3, %f1 + fors %f1, %f3, %f4 + fands %f4, SIGN_BIT, %f4 + retl + fors %f1, %f4, %f0 +END (__fminf) +weak_alias (__fminf, fminf) -- cgit 1.4.1