From 10a87ca476bfd3ada1d7ecda377569055ea2891c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 4 Aug 2017 13:01:59 -0700 Subject: x86-64: Implement libm IFUNC selectors in C * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_ceil-sse4_1, s_ceilf-sse4_1, s_floor-sse4_1, s_floorf-sse4_1, s_nearbyint-sse4_1, s_nearbyintf-sse4_1, s_rint-sse4_1 and s_rintf-sse4_1. * sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h: New file. * sysdeps/x86_64/fpu/multiarch/s_ceil.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_floor.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_floorf.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_nearbyint.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_rint.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_rintf.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_ceil.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S: This. Don't include nor . Include . (__ceil): Removed. * sysdeps/x86_64/fpu/multiarch/s_ceilf.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S: This. Don't include nor . Include . (__ceilf): Removed. * sysdeps/x86_64/fpu/multiarch/s_floor.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S: This. Don't include nor . Include . (__floor): Removed. * sysdeps/x86_64/fpu/multiarch/s_floorf.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S: This. Don't include nor . Include . (__floorf): Removed. * sysdeps/x86_64/fpu/multiarch/s_nearbyint.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S: This. Don't include nor . Include . (__nearbyint): Removed. * sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S: This. Don't include nor . Include . (__nearbyintf): Removed. * sysdeps/x86_64/fpu/multiarch/s_rint.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S: This. Don't include nor . Include . (__rint): Removed. * sysdeps/x86_64/fpu/multiarch/s_rintf.S: Renamed to ... * sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S: This. Don't include nor . Include . (__rintf): Removed. --- ChangeLog | 48 ++++++++++++++++++++++ sysdeps/x86_64/fpu/multiarch/Makefile | 4 ++ sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h | 33 +++++++++++++++ sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_ceil.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_ceil.c | 29 +++++++++++++ sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_ceilf.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_ceilf.c | 29 +++++++++++++ sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_floor.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_floor.c | 29 +++++++++++++ sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_floorf.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_floorf.c | 29 +++++++++++++ sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_nearbyint.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_nearbyint.c | 30 ++++++++++++++ sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c | 30 ++++++++++++++ sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_rint.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_rint.c | 29 +++++++++++++ sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S | 25 +++++++++++ sysdeps/x86_64/fpu/multiarch/s_rintf.S | 38 ----------------- sysdeps/x86_64/fpu/multiarch/s_rintf.c | 29 +++++++++++++ 27 files changed, 519 insertions(+), 304 deletions(-) create mode 100644 sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h create mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceil.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceil.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceilf.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_ceilf.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_floor.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_floor.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_floorf.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_floorf.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyint.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyint.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_rint.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_rint.c create mode 100644 sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S delete mode 100644 sysdeps/x86_64/fpu/multiarch/s_rintf.S create mode 100644 sysdeps/x86_64/fpu/multiarch/s_rintf.c diff --git a/ChangeLog b/ChangeLog index acfcdcc..421a0e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,53 @@ 2017-08-04 H.J. Lu + * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): + Add s_ceil-sse4_1, s_ceilf-sse4_1, s_floor-sse4_1, + s_floorf-sse4_1, s_nearbyint-sse4_1, s_nearbyintf-sse4_1, + s_rint-sse4_1 and s_rintf-sse4_1. + * sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h: New file. + * sysdeps/x86_64/fpu/multiarch/s_ceil.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_floor.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_floorf.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_nearbyint.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_rint.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_rintf.c: Likewise. + * sysdeps/x86_64/fpu/multiarch/s_ceil.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S: This. Don't + include nor . Include . + (__ceil): Removed. + * sysdeps/x86_64/fpu/multiarch/s_ceilf.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S: This. Don't + include nor . Include . + (__ceilf): Removed. + * sysdeps/x86_64/fpu/multiarch/s_floor.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S: This. Don't + include nor . Include . + (__floor): Removed. + * sysdeps/x86_64/fpu/multiarch/s_floorf.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S: This. Don't + include nor . Include . + (__floorf): Removed. + * sysdeps/x86_64/fpu/multiarch/s_nearbyint.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S: This. Don't + include nor . Include . + (__nearbyint): Removed. + * sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S: This. Don't + include nor . Include . + (__nearbyintf): Removed. + * sysdeps/x86_64/fpu/multiarch/s_rint.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S: This. Don't + include nor . Include . + (__rint): Removed. + * sysdeps/x86_64/fpu/multiarch/s_rintf.S: Renamed to ... + * sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S: This. Don't + include nor . Include . + (__rintf): Removed. + +2017-08-04 H.J. Lu + * sysdeps/i386/start.S (_start): Check Check PIC instead of SHARED. Avoid dynamic relocation against main in static PIE. diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index 3454215..86ddde3 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -2,6 +2,10 @@ ifeq ($(subdir),math) libm-sysdep_routines += s_floor-c s_ceil-c s_floorf-c s_ceilf-c \ s_rint-c s_rintf-c s_nearbyint-c s_nearbyintf-c +libm-sysdep_routines += s_ceil-sse4_1 s_ceilf-sse4_1 s_floor-sse4_1 \ + s_floorf-sse4_1 s_nearbyint-sse4_1 \ + s_nearbyintf-sse4_1 s_rint-sse4_1 s_rintf-sse4_1 + libm-sysdep_routines += e_exp-fma4 e_log-fma4 e_pow-fma4 s_atan-fma4 \ e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 \ mplog-fma4 mpa-fma4 slowexp-fma4 slowpow-fma4 \ diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h b/sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h new file mode 100644 index 0000000..ad8d878 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h @@ -0,0 +1,33 @@ +/* Common definition for ifunc selections optimized with SSE4.1. + Copyright (C) 2017 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 + +extern __typeof (REDIRECT_NAME) OPTIMIZE (c) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (sse41) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (void) +{ + const struct cpu_features* cpu_features = __get_cpu_features (); + + if (CPU_FEATURES_CPU_P (cpu_features, SSE4_1)) + return OPTIMIZE (sse41); + + return OPTIMIZE (c); +} diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S new file mode 100644 index 0000000..6d6be97 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__ceil_sse41) + roundsd $10, %xmm0, %xmm0 + ret +END(__ceil_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil.S b/sysdeps/x86_64/fpu/multiarch/s_ceil.S deleted file mode 100644 index f8eef43..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_ceil.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__ceil) - .type __ceil, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __ceil_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __ceil_c(%rip), %rax -2: ret -END(__ceil) -weak_alias (__ceil, ceil) - - -ENTRY(__ceil_sse41) - roundsd $10, %xmm0, %xmm0 - ret -END(__ceil_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil.c b/sysdeps/x86_64/fpu/multiarch/s_ceil.c new file mode 100644 index 0000000..2c01957 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_ceil.c @@ -0,0 +1,29 @@ +/* Multiple versions of __ceil. + Copyright (C) 2017 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 + . */ + +#define ceil __redirect_ceil +#define __ceil __redirect___ceil +#include +#undef ceil +#undef __ceil + +#define SYMBOL_NAME ceil +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_ceil, __ceil, IFUNC_SELECTOR ()); +weak_alias (__ceil, ceil) diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S new file mode 100644 index 0000000..9081ce6 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__ceilf_sse41) + roundss $10, %xmm0, %xmm0 + ret +END(__ceilf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceilf.S b/sysdeps/x86_64/fpu/multiarch/s_ceilf.S deleted file mode 100644 index 076f10f..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_ceilf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__ceilf) - .type __ceilf, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __ceilf_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __ceilf_c(%rip), %rax -2: ret -END(__ceilf) -weak_alias (__ceilf, ceilf) - - -ENTRY(__ceilf_sse41) - roundss $10, %xmm0, %xmm0 - ret -END(__ceilf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceilf.c b/sysdeps/x86_64/fpu/multiarch/s_ceilf.c new file mode 100644 index 0000000..090de04 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_ceilf.c @@ -0,0 +1,29 @@ +/* Multiple versions of __ceilf. + Copyright (C) 2017 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 + . */ + +#define ceilf __redirect_ceilf +#define __ceilf __redirect___ceilf +#include +#undef ceilf +#undef __ceilf + +#define SYMBOL_NAME ceilf +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_ceilf, __ceilf, IFUNC_SELECTOR ()); +weak_alias (__ceilf, ceilf) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S new file mode 100644 index 0000000..022a4ac --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__floor_sse41) + roundsd $9, %xmm0, %xmm0 + ret +END(__floor_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor.S b/sysdeps/x86_64/fpu/multiarch/s_floor.S deleted file mode 100644 index f519ab2..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_floor.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__floor) - .type __floor, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __floor_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __floor_c(%rip), %rax -2: ret -END(__floor) -weak_alias (__floor, floor) - - -ENTRY(__floor_sse41) - roundsd $9, %xmm0, %xmm0 - ret -END(__floor_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor.c b/sysdeps/x86_64/fpu/multiarch/s_floor.c new file mode 100644 index 0000000..3dd0f81 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_floor.c @@ -0,0 +1,29 @@ +/* Multiple versions of __floor. + Copyright (C) 2017 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 + . */ + +#define floor __redirect_floor +#define __floor __redirect___floor +#include +#undef floor +#undef __floor + +#define SYMBOL_NAME floor +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_floor, __floor, IFUNC_SELECTOR ()); +weak_alias (__floor, floor) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S new file mode 100644 index 0000000..ea63144 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__floorf_sse41) + roundss $9, %xmm0, %xmm0 + ret +END(__floorf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floorf.S b/sysdeps/x86_64/fpu/multiarch/s_floorf.S deleted file mode 100644 index 8613f73..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_floorf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__floorf) - .type __floorf, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __floorf_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __floorf_c(%rip), %rax -2: ret -END(__floorf) -weak_alias (__floorf, floorf) - - -ENTRY(__floorf_sse41) - roundss $9, %xmm0, %xmm0 - ret -END(__floorf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_floorf.c b/sysdeps/x86_64/fpu/multiarch/s_floorf.c new file mode 100644 index 0000000..d6cf14d --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_floorf.c @@ -0,0 +1,29 @@ +/* Multiple versions of __floorf. + Copyright (C) 2017 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 + . */ + +#define floorf __redirect_floorf +#define __floorf __redirect___floorf +#include +#undef floorf +#undef __floorf + +#define SYMBOL_NAME floorf +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_floorf, __floorf, IFUNC_SELECTOR ()); +weak_alias (__floorf, floorf) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S new file mode 100644 index 0000000..68934aa --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__nearbyint_sse41) + roundsd $0xc, %xmm0, %xmm0 + ret +END(__nearbyint_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S b/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S deleted file mode 100644 index 5a734f6..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__nearbyint) - .type __nearbyint, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __nearbyint_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __nearbyint_c(%rip), %rax -2: ret -END(__nearbyint) -weak_alias (__nearbyint, nearbyint) - - -ENTRY(__nearbyint_sse41) - roundsd $0xc, %xmm0, %xmm0 - ret -END(__nearbyint_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c b/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c new file mode 100644 index 0000000..05579c6 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyint.c @@ -0,0 +1,30 @@ +/* Multiple versions of __nearbyint. + Copyright (C) 2017 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 + . */ + +#define nearbyint __redirect_nearbyint +#define __nearbyint __redirect___nearbyint +#include +#undef nearbyint +#undef __nearbyint + +#define SYMBOL_NAME nearbyint +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_nearbyint, __nearbyint, + IFUNC_SELECTOR ()); +weak_alias (__nearbyint, nearbyint) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S new file mode 100644 index 0000000..16bd905 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__nearbyintf_sse41) + roundss $0xc, %xmm0, %xmm0 + ret +END(__nearbyintf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S deleted file mode 100644 index ad79fd6..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__nearbyintf) - .type __nearbyintf, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __nearbyintf_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __nearbyintf_c(%rip), %rax -2: ret -END(__nearbyintf) -weak_alias (__nearbyintf, nearbyintf) - - -ENTRY(__nearbyintf_sse41) - roundss $0xc, %xmm0, %xmm0 - ret -END(__nearbyintf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c new file mode 100644 index 0000000..e716c94 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c @@ -0,0 +1,30 @@ +/* Multiple versions of __nearbyintf. + Copyright (C) 2017 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 + . */ + +#define nearbyintf __redirect_nearbyintf +#define __nearbyintf __redirect___nearbyintf +#include +#undef nearbyintf +#undef __nearbyintf + +#define SYMBOL_NAME nearbyintf +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_nearbyintf, __nearbyintf, + IFUNC_SELECTOR ()); +weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S new file mode 100644 index 0000000..9224aa9 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__rint_sse41) + roundsd $4, %xmm0, %xmm0 + ret +END(__rint_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint.S b/sysdeps/x86_64/fpu/multiarch/s_rint.S deleted file mode 100644 index 4f628a9..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_rint.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__rint) - .type __rint, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __rint_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __rint_c(%rip), %rax -2: ret -END(__rint) -weak_alias (__rint, rint) - - -ENTRY(__rint_sse41) - roundsd $4, %xmm0, %xmm0 - ret -END(__rint_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint.c b/sysdeps/x86_64/fpu/multiarch/s_rint.c new file mode 100644 index 0000000..ad44e7c --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_rint.c @@ -0,0 +1,29 @@ +/* Multiple versions of __rint. + Copyright (C) 2017 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 + . */ + +#define rint __redirect_rint +#define __rint __redirect___rint +#include +#undef rint +#undef __rint + +#define SYMBOL_NAME rint +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_rint, __rint, IFUNC_SELECTOR ()); +weak_alias (__rint, rint) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S new file mode 100644 index 0000000..7f47592 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S @@ -0,0 +1,25 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. + + 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 + + .section .text.sse4.1,"ax",@progbits +ENTRY(__rintf_sse41) + roundss $4, %xmm0, %xmm0 + ret +END(__rintf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rintf.S b/sysdeps/x86_64/fpu/multiarch/s_rintf.S deleted file mode 100644 index dee4ad7..0000000 --- a/sysdeps/x86_64/fpu/multiarch/s_rintf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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(__rintf) - .type __rintf, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX - leaq __rintf_sse41(%rip), %rax - HAS_CPU_FEATURE (SSE4_1) - jnz 2f - leaq __rintf_c(%rip), %rax -2: ret -END(__rintf) -weak_alias (__rintf, rintf) - - -ENTRY(__rintf_sse41) - roundss $4, %xmm0, %xmm0 - ret -END(__rintf_sse41) diff --git a/sysdeps/x86_64/fpu/multiarch/s_rintf.c b/sysdeps/x86_64/fpu/multiarch/s_rintf.c new file mode 100644 index 0000000..88f3052 --- /dev/null +++ b/sysdeps/x86_64/fpu/multiarch/s_rintf.c @@ -0,0 +1,29 @@ +/* Multiple versions of __rintf. + Copyright (C) 2017 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 + . */ + +#define rintf __redirect_rintf +#define __rintf __redirect___rintf +#include +#undef rintf +#undef __rintf + +#define SYMBOL_NAME rintf +#include "ifunc-sse4_1.h" + +libc_ifunc_redirected (__redirect_rintf, __rintf, IFUNC_SELECTOR ()); +weak_alias (__rintf, rintf) -- cgit v1.1