From 3a16dd780eeba60266d75e4a562536cc0785bc4e Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 20 Mar 2019 04:14:28 +0000 Subject: powerpc: fma using builtins This patch just refactor the assembly implementation to use compiler builtins instead. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_fma.S: Remove file. * sysdeps/powerpc/fpu/s_fmaf.S: Likewise. * sysdeps/powerpc/fpu/s_fma.c: New file. * sysdeps/powerpc/fpu/s_fmaf.c: Likewise. --- ChangeLog | 5 +++++ sysdeps/powerpc/fpu/s_fma.S | 28 ---------------------------- sysdeps/powerpc/fpu/s_fma.c | 26 ++++++++++++++++++++++++++ sysdeps/powerpc/fpu/s_fmaf.S | 28 ---------------------------- sysdeps/powerpc/fpu/s_fmaf.c | 26 ++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 56 deletions(-) delete mode 100644 sysdeps/powerpc/fpu/s_fma.S create mode 100644 sysdeps/powerpc/fpu/s_fma.c delete mode 100644 sysdeps/powerpc/fpu/s_fmaf.S create mode 100644 sysdeps/powerpc/fpu/s_fmaf.c diff --git a/ChangeLog b/ChangeLog index a4eb322b1d..8a852d903d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2019-04-17 Adhemerval Zanella + * sysdeps/powerpc/fpu/s_fma.S: Remove file. + * sysdeps/powerpc/fpu/s_fmaf.S: Likewise. + * sysdeps/powerpc/fpu/s_fma.c: New file. + * sysdeps/powerpc/fpu/s_fmaf.c: Likewise. + * sysdeps/powerpc/fpu/s_fabs.S: Remove file. * sysdeps/powerpc/fpu/s_fabsf.S: Likewise. diff --git a/sysdeps/powerpc/fpu/s_fma.S b/sysdeps/powerpc/fpu/s_fma.S deleted file mode 100644 index 92e08eb583..0000000000 --- a/sysdeps/powerpc/fpu/s_fma.S +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 -#include - -ENTRY_TOCLESS(__fma) -/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */ - fmadd fp1,fp1,fp2,fp3 - blr -END(__fma) - -libm_alias_double (__fma, fma) diff --git a/sysdeps/powerpc/fpu/s_fma.c b/sysdeps/powerpc/fpu/s_fma.c new file mode 100644 index 0000000000..688f9badf5 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fma.c @@ -0,0 +1,26 @@ +/* Compute x * y + z as ternary operation. PowerPC version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 +#include + +double __fma (double x, double y, double z) +{ + return __builtin_fma (x, y, z); +} +libm_alias_double (__fma, fma) diff --git a/sysdeps/powerpc/fpu/s_fmaf.S b/sysdeps/powerpc/fpu/s_fmaf.S deleted file mode 100644 index 9579e9492e..0000000000 --- a/sysdeps/powerpc/fpu/s_fmaf.S +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 -#include - -ENTRY_TOCLESS(__fmaf) -/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */ - fmadds fp1,fp1,fp2,fp3 - blr -END(__fmaf) - -libm_alias_float (__fma, fma) diff --git a/sysdeps/powerpc/fpu/s_fmaf.c b/sysdeps/powerpc/fpu/s_fmaf.c new file mode 100644 index 0000000000..38b59e1f2f --- /dev/null +++ b/sysdeps/powerpc/fpu/s_fmaf.c @@ -0,0 +1,26 @@ +/* Compute x * y + z as ternary operation. PowerPC version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 +#include + +float __fmaf (float x, float y, float z) +{ + return __builtin_fmaf (x, y, z); +} +libm_alias_float (__fma, fma) -- cgit 1.4.1