x86-64: Add vector acosh/acoshf implementation to libmvec

Implement vectorized acosh/acoshf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector acosh/acoshf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
Sunil K Pandey 2021-12-29 09:48:17 -08:00
parent 6dea4dd3da
commit 0625489ccc
50 changed files with 5265 additions and 1 deletions

View File

@ -263,4 +263,15 @@
#define __DECL_SIMD_atanhf32x
#define __DECL_SIMD_atanhf64x
#define __DECL_SIMD_atanhf128x
#define __DECL_SIMD_acosh
#define __DECL_SIMD_acoshf
#define __DECL_SIMD_acoshl
#define __DECL_SIMD_acoshf16
#define __DECL_SIMD_acoshf32
#define __DECL_SIMD_acoshf64
#define __DECL_SIMD_acoshf128
#define __DECL_SIMD_acoshf32x
#define __DECL_SIMD_acoshf64x
#define __DECL_SIMD_acoshf128x
#endif

View File

@ -82,7 +82,7 @@ __MATHDECL_VEC (void,sincos,,
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* Hyperbolic arc cosine of X. */
__MATHCALL (acosh,, (_Mdouble_ __x));
__MATHCALL_VEC (acosh,, (_Mdouble_ __x));
/* Hyperbolic arc sine of X. */
__MATHCALL (asinh,, (_Mdouble_ __x));
/* Hyperbolic arc tangent of X. */

View File

@ -47,6 +47,7 @@ GLIBC_2.22 _ZGVeN8v_sin F
GLIBC_2.22 _ZGVeN8vv_pow F
GLIBC_2.22 _ZGVeN8vvv_sincos F
GLIBC_2.35 _ZGVbN2v_acos F
GLIBC_2.35 _ZGVbN2v_acosh F
GLIBC_2.35 _ZGVbN2v_asin F
GLIBC_2.35 _ZGVbN2v_atan F
GLIBC_2.35 _ZGVbN2v_atanh F
@ -62,6 +63,7 @@ GLIBC_2.35 _ZGVbN2v_sinh F
GLIBC_2.35 _ZGVbN2vv_atan2 F
GLIBC_2.35 _ZGVbN2vv_hypot F
GLIBC_2.35 _ZGVbN4v_acosf F
GLIBC_2.35 _ZGVbN4v_acoshf F
GLIBC_2.35 _ZGVbN4v_asinf F
GLIBC_2.35 _ZGVbN4v_atanf F
GLIBC_2.35 _ZGVbN4v_atanhf F
@ -77,6 +79,7 @@ GLIBC_2.35 _ZGVbN4v_sinhf F
GLIBC_2.35 _ZGVbN4vv_atan2f F
GLIBC_2.35 _ZGVbN4vv_hypotf F
GLIBC_2.35 _ZGVcN4v_acos F
GLIBC_2.35 _ZGVcN4v_acosh F
GLIBC_2.35 _ZGVcN4v_asin F
GLIBC_2.35 _ZGVcN4v_atan F
GLIBC_2.35 _ZGVcN4v_atanh F
@ -92,6 +95,7 @@ GLIBC_2.35 _ZGVcN4v_sinh F
GLIBC_2.35 _ZGVcN4vv_atan2 F
GLIBC_2.35 _ZGVcN4vv_hypot F
GLIBC_2.35 _ZGVcN8v_acosf F
GLIBC_2.35 _ZGVcN8v_acoshf F
GLIBC_2.35 _ZGVcN8v_asinf F
GLIBC_2.35 _ZGVcN8v_atanf F
GLIBC_2.35 _ZGVcN8v_atanhf F
@ -107,6 +111,7 @@ GLIBC_2.35 _ZGVcN8v_sinhf F
GLIBC_2.35 _ZGVcN8vv_atan2f F
GLIBC_2.35 _ZGVcN8vv_hypotf F
GLIBC_2.35 _ZGVdN4v_acos F
GLIBC_2.35 _ZGVdN4v_acosh F
GLIBC_2.35 _ZGVdN4v_asin F
GLIBC_2.35 _ZGVdN4v_atan F
GLIBC_2.35 _ZGVdN4v_atanh F
@ -122,6 +127,7 @@ GLIBC_2.35 _ZGVdN4v_sinh F
GLIBC_2.35 _ZGVdN4vv_atan2 F
GLIBC_2.35 _ZGVdN4vv_hypot F
GLIBC_2.35 _ZGVdN8v_acosf F
GLIBC_2.35 _ZGVdN8v_acoshf F
GLIBC_2.35 _ZGVdN8v_asinf F
GLIBC_2.35 _ZGVdN8v_atanf F
GLIBC_2.35 _ZGVdN8v_atanhf F
@ -137,6 +143,7 @@ GLIBC_2.35 _ZGVdN8v_sinhf F
GLIBC_2.35 _ZGVdN8vv_atan2f F
GLIBC_2.35 _ZGVdN8vv_hypotf F
GLIBC_2.35 _ZGVeN16v_acosf F
GLIBC_2.35 _ZGVeN16v_acoshf F
GLIBC_2.35 _ZGVeN16v_asinf F
GLIBC_2.35 _ZGVeN16v_atanf F
GLIBC_2.35 _ZGVeN16v_atanhf F
@ -152,6 +159,7 @@ GLIBC_2.35 _ZGVeN16v_sinhf F
GLIBC_2.35 _ZGVeN16vv_atan2f F
GLIBC_2.35 _ZGVeN16vv_hypotf F
GLIBC_2.35 _ZGVeN8v_acos F
GLIBC_2.35 _ZGVeN8v_acosh F
GLIBC_2.35 _ZGVeN8v_asin F
GLIBC_2.35 _ZGVeN8v_atan F
GLIBC_2.35 _ZGVeN8v_atanh F

View File

@ -118,6 +118,10 @@
# define __DECL_SIMD_atanh __DECL_SIMD_x86_64
# undef __DECL_SIMD_atanhf
# define __DECL_SIMD_atanhf __DECL_SIMD_x86_64
# undef __DECL_SIMD_acosh
# define __DECL_SIMD_acosh __DECL_SIMD_x86_64
# undef __DECL_SIMD_acoshf
# define __DECL_SIMD_acoshf __DECL_SIMD_x86_64
# endif
#endif

View File

@ -58,6 +58,8 @@
!GCC$ builtin (log1pf) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (atanh) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (atanhf) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (acosh) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (acoshf) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
@ -101,3 +103,5 @@
!GCC$ builtin (log1pf) attributes simd (notinbranch) if('x32')
!GCC$ builtin (atanh) attributes simd (notinbranch) if('x32')
!GCC$ builtin (atanhf) attributes simd (notinbranch) if('x32')
!GCC$ builtin (acosh) attributes simd (notinbranch) if('x32')
!GCC$ builtin (acoshf) attributes simd (notinbranch) if('x32')

View File

@ -23,6 +23,7 @@ postclean-generated += libmvec.mk
# Define for both math and mathvec directories.
libmvec-funcs = \
acos \
acosh \
asin \
atan \
atan2 \

View File

@ -15,6 +15,7 @@ libmvec {
}
GLIBC_2.35 {
_ZGVbN2v_acos; _ZGVcN4v_acos; _ZGVdN4v_acos; _ZGVeN8v_acos;
_ZGVbN2v_acosh; _ZGVcN4v_acosh; _ZGVdN4v_acosh; _ZGVeN8v_acosh;
_ZGVbN2v_asin; _ZGVcN4v_asin; _ZGVdN4v_asin; _ZGVeN8v_asin;
_ZGVbN2v_atan; _ZGVcN4v_atan; _ZGVdN4v_atan; _ZGVeN8v_atan;
_ZGVbN2v_atanh; _ZGVcN4v_atanh; _ZGVdN4v_atanh; _ZGVeN8v_atanh;
@ -30,6 +31,7 @@ libmvec {
_ZGVbN2vv_atan2; _ZGVcN4vv_atan2; _ZGVdN4vv_atan2; _ZGVeN8vv_atan2;
_ZGVbN2vv_hypot; _ZGVcN4vv_hypot; _ZGVdN4vv_hypot; _ZGVeN8vv_hypot;
_ZGVbN4v_acosf; _ZGVcN8v_acosf; _ZGVdN8v_acosf; _ZGVeN16v_acosf;
_ZGVbN4v_acoshf; _ZGVcN8v_acoshf; _ZGVdN8v_acoshf; _ZGVeN16v_acoshf;
_ZGVbN4v_asinf; _ZGVcN8v_asinf; _ZGVdN8v_asinf; _ZGVeN16v_asinf;
_ZGVbN4v_atanf; _ZGVcN8v_atanf; _ZGVdN8v_atanf; _ZGVeN16v_atanf;
_ZGVbN4v_atanhf; _ZGVcN8v_atanhf; _ZGVdN8v_atanhf; _ZGVeN16v_atanhf;

View File

@ -69,6 +69,26 @@ float: 2
float128: 3
ldouble: 3
Function: "acosh_vlen16":
float: 1
Function: "acosh_vlen2":
double: 2
Function: "acosh_vlen4":
double: 2
float: 1
Function: "acosh_vlen4_avx2":
double: 2
Function: "acosh_vlen8":
double: 1
float: 1
Function: "acosh_vlen8_avx2":
float: 2
Function: "asin":
double: 1
float: 1

View File

@ -0,0 +1,20 @@
/* SSE2 version of vectorized acosh, vector length is 2.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVbN2v_acosh _ZGVbN2v_acosh_sse2
#include "../svml_d_acosh2_core.S"

View File

@ -0,0 +1,27 @@
/* Multiple versions of vectorized acosh, vector length is 2.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVbN2v_acosh
#include "ifunc-mathvec-sse4_1.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVbN2v_acosh, __GI__ZGVbN2v_acosh, __redirect__ZGVbN2v_acosh)
__attribute__ ((visibility ("hidden")));
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/* SSE version of vectorized acosh, vector length is 4.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVdN4v_acosh _ZGVdN4v_acosh_sse_wrapper
#include "../svml_d_acosh4_core.S"

View File

@ -0,0 +1,27 @@
/* Multiple versions of vectorized acosh, vector length is 4.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVdN4v_acosh
#include "ifunc-mathvec-avx2.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVdN4v_acosh, __GI__ZGVdN4v_acosh, __redirect__ZGVdN4v_acosh)
__attribute__ ((visibility ("hidden")));
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/* AVX2 version of vectorized acosh, vector length is 8.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVeN8v_acosh _ZGVeN8v_acosh_avx2_wrapper
#include "../svml_d_acosh8_core.S"

View File

@ -0,0 +1,27 @@
/* Multiple versions of vectorized acosh, vector length is 8.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVeN8v_acosh
#include "ifunc-mathvec-avx512-skx.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVeN8v_acosh, __GI__ZGVeN8v_acosh, __redirect__ZGVeN8v_acosh)
__attribute__ ((visibility ("hidden")));
#endif

View File

@ -0,0 +1,480 @@
/* Function acosh vectorized with AVX-512.
Copyright (C) 2021 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
https://www.gnu.org/licenses/. */
/*
* ALGORITHM DESCRIPTION:
*
* Compute acosh(x) as log(x + sqrt(x*x - 1))
* using RSQRT instructions for starting the
* square root approximation, and small table lookups for log
* that map to AVX-512 permute instructions
*
* Special cases:
*
* acosh(NaN) = quiet NaN, and raise invalid exception
* acosh(-INF) = NaN
* acosh(+INF) = +INF
* acosh(x) = NaN if x < 1
* acosh(1) = +0
*
*/
/* Offsets for data table __svml_dacosh_data_internal_avx512
*/
#define Log_tbl_H 0
#define Log_tbl_L 128
#define One 256
#define SmallThreshold 320
#define Threshold 384
#define LargeThreshold 448
#define ca2 512
#define ca1 576
#define c4s 640
#define c3s 704
#define c2s 768
#define c1s 832
#define AddB5 896
#define RcpBitMask 960
#define OneEighth 1024
#define Four 1088
#define poly_coeff9 1152
#define poly_coeff8 1216
#define poly_coeff7 1280
#define poly_coeff6 1344
#define poly_coeff5 1408
#define poly_coeff4 1472
#define poly_coeff3 1536
#define poly_coeff2 1600
#define poly_coeff1 1664
#define L2H 1728
#define L2L 1792
#include <sysdep.h>
.text
.section .text.evex512,"ax",@progbits
ENTRY(_ZGVeN8v_acosh_skx)
pushq %rbp
cfi_def_cfa_offset(16)
movq %rsp, %rbp
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
andq $-64, %rsp
subq $192, %rsp
vmovups One+__svml_dacosh_data_internal_avx512(%rip), %zmm5
/* polynomial computation for small inputs */
vmovups ca2+__svml_dacosh_data_internal_avx512(%rip), %zmm13
vmovups ca1+__svml_dacosh_data_internal_avx512(%rip), %zmm14
/*
* sqrt(1+x^2) ~ Sh + Sl + Sh*Eh*poly_s
* poly_s = c1+c2*Eh+c3*Eh^2
*/
vmovups c4s+__svml_dacosh_data_internal_avx512(%rip), %zmm1
vmovups c2s+__svml_dacosh_data_internal_avx512(%rip), %zmm2
vmovups c1s+__svml_dacosh_data_internal_avx512(%rip), %zmm6
/* very large inputs ? */
vmovups Threshold+__svml_dacosh_data_internal_avx512(%rip), %zmm15
/* out of range inputs? */
vmovups LargeThreshold+__svml_dacosh_data_internal_avx512(%rip), %zmm3
/* not a very small input ? */
vmovups SmallThreshold+__svml_dacosh_data_internal_avx512(%rip), %zmm10
vmovaps %zmm0, %zmm12
/* x^2 - 1 */
vmovaps %zmm5, %zmm11
vfmsub231pd {rn-sae}, %zmm12, %zmm12, %zmm11
vcmppd $21, {sae}, %zmm15, %zmm12, %k2
vcmppd $22, {sae}, %zmm3, %zmm12, %k0
vcmppd $18, {sae}, %zmm5, %zmm12, %k1
vrsqrt14pd %zmm11, %zmm4
vcmppd $21, {sae}, %zmm10, %zmm11, %k3
vfmadd231pd {rn-sae}, %zmm11, %zmm13, %zmm14
vmovups c3s+__svml_dacosh_data_internal_avx512(%rip), %zmm13
/* Sh ~sqrt(-1+x^2) */
vmulpd {rn-sae}, %zmm4, %zmm11, %zmm9
vmulpd {rn-sae}, %zmm11, %zmm14, %zmm8
/* Sh+x */
vaddpd {rn-sae}, %zmm12, %zmm9, %zmm15
/* Shh */
vsubpd {rn-sae}, %zmm12, %zmm15, %zmm14
/* (Yh*R0)_low */
vmovaps %zmm11, %zmm0
korw %k0, %k1, %k0
/* rel. error term: Eh=1-Sh*R0 */
vmovaps %zmm5, %zmm7
vfmsub213pd {rn-sae}, %zmm9, %zmm4, %zmm0
vfnmadd231pd {rn-sae}, %zmm9, %zmm4, %zmm7
/* rel. error term: Eh=(1-Sh*R0)-Sl*R0 */
vfnmadd231pd {rn-sae}, %zmm0, %zmm4, %zmm7
/* Shl */
vsubpd {rn-sae}, %zmm14, %zmm9, %zmm4
vmovups poly_coeff7+__svml_dacosh_data_internal_avx512(%rip), %zmm14
vfmadd231pd {rn-sae}, %zmm7, %zmm1, %zmm13
vfmadd213pd {rn-sae}, %zmm2, %zmm7, %zmm13
vfmadd213pd {rn-sae}, %zmm6, %zmm7, %zmm13
/* Sh*Eh */
vmulpd {rn-sae}, %zmm7, %zmm9, %zmm7
/* Sl + Sh*Eh*poly_s */
vfmadd213pd {rn-sae}, %zmm0, %zmm13, %zmm7
/* polynomials */
vmovups poly_coeff9+__svml_dacosh_data_internal_avx512(%rip), %zmm13
/* polynomial computation for small inputs */
vaddpd {rn-sae}, %zmm7, %zmm9, %zmm0
/* Xin0+Sl+Sh*Eh*poly_s ~ x+sqrt(1+x^2) */
vaddpd {rn-sae}, %zmm7, %zmm15, %zmm6
vfmadd231pd {rn-sae}, %zmm0, %zmm8, %zmm0
/* fixup for very large inputs */
vmovups OneEighth+__svml_dacosh_data_internal_avx512(%rip), %zmm8
/* Sl_high */
vsubpd {rn-sae}, %zmm15, %zmm6, %zmm9
vmovups poly_coeff6+__svml_dacosh_data_internal_avx512(%rip), %zmm15
vmulpd {rn-sae}, %zmm8, %zmm12, %zmm6{%k2}
/* Sl_l */
vsubpd {rn-sae}, %zmm9, %zmm7, %zmm3
vrcp14pd %zmm6, %zmm1
/* Xin_low */
vaddpd {rn-sae}, %zmm4, %zmm3, %zmm7
/* Table lookups */
vmovups __svml_dacosh_data_internal_avx512(%rip), %zmm3
/* round reciprocal to 1+4b mantissas */
vpaddq AddB5+__svml_dacosh_data_internal_avx512(%rip), %zmm1, %zmm2
/* fixup for very large inputs */
vxorpd %zmm7, %zmm7, %zmm7{%k2}
vmovups poly_coeff8+__svml_dacosh_data_internal_avx512(%rip), %zmm1
vandpd RcpBitMask+__svml_dacosh_data_internal_avx512(%rip), %zmm2, %zmm8
vmovups Log_tbl_L+__svml_dacosh_data_internal_avx512(%rip), %zmm2
/* Prepare table index */
vpsrlq $48, %zmm8, %zmm9
/* reduced argument for log(): (Rcp*Xin-1)+Rcp*Xin_low */
vfmsub231pd {rn-sae}, %zmm8, %zmm6, %zmm5
/* exponents */
vgetexppd {sae}, %zmm8, %zmm4
vmovups Four+__svml_dacosh_data_internal_avx512(%rip), %zmm6
vpermt2pd Log_tbl_H+64+__svml_dacosh_data_internal_avx512(%rip), %zmm9, %zmm3
vpermt2pd Log_tbl_L+64+__svml_dacosh_data_internal_avx512(%rip), %zmm9, %zmm2
vsubpd {rn-sae}, %zmm6, %zmm4, %zmm4{%k2}
vfmadd231pd {rn-sae}, %zmm8, %zmm7, %zmm5
vmovups poly_coeff5+__svml_dacosh_data_internal_avx512(%rip), %zmm6
vmovups poly_coeff4+__svml_dacosh_data_internal_avx512(%rip), %zmm7
/* -K*L2H + Th */
vmovups L2H+__svml_dacosh_data_internal_avx512(%rip), %zmm8
/* -K*L2L + Tl */
vmovups L2L+__svml_dacosh_data_internal_avx512(%rip), %zmm9
vfmadd231pd {rn-sae}, %zmm5, %zmm13, %zmm1
vmovups poly_coeff2+__svml_dacosh_data_internal_avx512(%rip), %zmm13
vfnmadd231pd {rn-sae}, %zmm4, %zmm8, %zmm3
vfnmadd213pd {rn-sae}, %zmm2, %zmm9, %zmm4
vfmadd213pd {rn-sae}, %zmm14, %zmm5, %zmm1
vmovups poly_coeff3+__svml_dacosh_data_internal_avx512(%rip), %zmm2
vmovups poly_coeff1+__svml_dacosh_data_internal_avx512(%rip), %zmm14
vfmadd213pd {rn-sae}, %zmm15, %zmm5, %zmm1
/* R^2 */
vmulpd {rn-sae}, %zmm5, %zmm5, %zmm15
vfmadd213pd {rn-sae}, %zmm6, %zmm5, %zmm1
vfmadd213pd {rn-sae}, %zmm7, %zmm5, %zmm1
vfmadd213pd {rn-sae}, %zmm2, %zmm5, %zmm1
vfmadd213pd {rn-sae}, %zmm13, %zmm5, %zmm1
vfmadd213pd {rn-sae}, %zmm14, %zmm5, %zmm1
/* Tl + R^2*Poly */
vfmadd213pd {rn-sae}, %zmm4, %zmm15, %zmm1
/* R+Tl + R^2*Poly */
vaddpd {rn-sae}, %zmm5, %zmm1, %zmm5
vaddpd {rn-sae}, %zmm5, %zmm3, %zmm0{%k3}
/* Go to special inputs processing branch */
jne L(SPECIAL_VALUES_BRANCH)
# LOE rbx r12 r13 r14 r15 k0 zmm0 zmm12
/* Restore registers
* and exit the function
*/
L(EXIT):
movq %rbp, %rsp
popq %rbp
cfi_def_cfa(7, 8)
cfi_restore(6)
ret
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
/* Branch to process
* special inputs
*/
L(SPECIAL_VALUES_BRANCH):
vmovups %zmm12, 64(%rsp)
vmovups %zmm0, 128(%rsp)
# LOE rbx r12 r13 r14 r15 k0 zmm0
xorl %eax, %eax
# LOE rbx r12 r13 r14 r15 eax k0
vzeroupper
movq %r12, 16(%rsp)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -176; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x50, 0xff, 0xff, 0xff, 0x22
movl %eax, %r12d
movq %r13, 8(%rsp)
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
kmovd %k0, %r13d
movq %r14, (%rsp)
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
# LOE rbx r15 r12d r13d
/* Range mask
* bits check
*/
L(RANGEMASK_CHECK):
btl %r12d, %r13d
/* Call scalar math function */
jc L(SCALAR_MATH_CALL)
# LOE rbx r15 r12d r13d
/* Special inputs
* processing loop
*/
L(SPECIAL_VALUES_LOOP):
incl %r12d
cmpl $8, %r12d
/* Check bits in range mask */
jl L(RANGEMASK_CHECK)
# LOE rbx r15 r12d r13d
movq 16(%rsp), %r12
cfi_restore(12)
movq 8(%rsp), %r13
cfi_restore(13)
movq (%rsp), %r14
cfi_restore(14)
vmovups 128(%rsp), %zmm0
/* Go to exit */
jmp L(EXIT)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -176; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x50, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
# LOE rbx r12 r13 r14 r15 zmm0
/* Scalar math fucntion call
* to process special input
*/
L(SCALAR_MATH_CALL):
movl %r12d, %r14d
movsd 64(%rsp,%r14,8), %xmm0
call acosh@PLT
# LOE rbx r14 r15 r12d r13d xmm0
movsd %xmm0, 128(%rsp,%r14,8)
/* Process special inputs in loop */
jmp L(SPECIAL_VALUES_LOOP)
# LOE rbx r15 r12d r13d
END(_ZGVeN8v_acosh_skx)
.section .rodata, "a"
.align 64
#ifdef __svml_dacosh_data_internal_avx512_typedef
typedef unsigned int VUINT32;
typedef struct {
__declspec(align(64)) VUINT32 Log_tbl_H[16][2];
__declspec(align(64)) VUINT32 Log_tbl_L[16][2];
__declspec(align(64)) VUINT32 One[8][2];
__declspec(align(64)) VUINT32 SmallThreshold[8][2];
__declspec(align(64)) VUINT32 Threshold[8][2];
__declspec(align(64)) VUINT32 LargeThreshold[8][2];
__declspec(align(64)) VUINT32 ca2[8][2];
__declspec(align(64)) VUINT32 ca1[8][2];
__declspec(align(64)) VUINT32 c4s[8][2];
__declspec(align(64)) VUINT32 c3s[8][2];
__declspec(align(64)) VUINT32 c2s[8][2];
__declspec(align(64)) VUINT32 c1s[8][2];
__declspec(align(64)) VUINT32 AddB5[8][2];
__declspec(align(64)) VUINT32 RcpBitMask[8][2];
__declspec(align(64)) VUINT32 OneEighth[8][2];
__declspec(align(64)) VUINT32 Four[8][2];
__declspec(align(64)) VUINT32 poly_coeff9[8][2];
__declspec(align(64)) VUINT32 poly_coeff8[8][2];
__declspec(align(64)) VUINT32 poly_coeff7[8][2];
__declspec(align(64)) VUINT32 poly_coeff6[8][2];
__declspec(align(64)) VUINT32 poly_coeff5[8][2];
__declspec(align(64)) VUINT32 poly_coeff4[8][2];
__declspec(align(64)) VUINT32 poly_coeff3[8][2];
__declspec(align(64)) VUINT32 poly_coeff2[8][2];
__declspec(align(64)) VUINT32 poly_coeff1[8][2];
__declspec(align(64)) VUINT32 L2H[8][2];
__declspec(align(64)) VUINT32 L2L[8][2];
} __svml_dacosh_data_internal_avx512;
#endif
__svml_dacosh_data_internal_avx512:
/*== Log_tbl_H ==*/
.quad 0x0000000000000000
.quad 0xbfaf0a30c0120000
.quad 0xbfbe27076e2b0000
.quad 0xbfc5ff3070a78000
.quad 0xbfcc8ff7c79a8000
.quad 0xbfd1675cababc000
.quad 0xbfd4618bc21c4000
.quad 0xbfd739d7f6bbc000
.quad 0xbfd9f323ecbf8000
.quad 0xbfdc8ff7c79a8000
.quad 0xbfdf128f5faf0000
.quad 0xbfe0be72e4252000
.quad 0xbfe1e85f5e704000
.quad 0xbfe307d7334f2000
.quad 0xbfe41d8fe8468000
.quad 0xbfe52a2d265bc000
/*== Log_tbl_L ==*/
.align 64
.quad 0x0000000000000000
.quad 0x3d53ab33d066d1d2
.quad 0x3d2a342c2af0003c
.quad 0xbd43d3c873e20a07
.quad 0xbd4a21ac25d81ef3
.quad 0x3d59f1fc63382a8f
.quad 0xbd5ec27d0b7b37b3
.quad 0xbd50069ce24c53fb
.quad 0xbd584bf2b68d766f
.quad 0xbd5a21ac25d81ef3
.quad 0xbd3bb2cd720ec44c
.quad 0xbd55056d312f7668
.quad 0xbd1a07bd8b34be7c
.quad 0x3d5e83c094debc15
.quad 0x3d5aa33736867a17
.quad 0xbd46abb9df22bc57
/*== One ==*/
.align 64
.quad 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000, 0x3ff0000000000000
/*== SmallThreshold ==*/
.align 64
.quad 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000, 0x3ef0000000000000
/*== Threshold ==*/
.align 64
.quad 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000, 0x5fe0000000000000
/*== LargeThreshold ==*/
.align 64
.quad 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff, 0x7fefffffffffffff
/*== ca2 ==*/
.align 64
.quad 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7, 0x3fb333220eaf02e7
/*== ca1 ==*/
.align 64
.quad 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e, 0xbfc5555555521e7e
/*== c4s ==*/
.align 64
.quad 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612, 0x3fd1800001943612
/*== c3s ==*/
.align 64
.quad 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000, 0x3fd40000013b0000
/*== c2s ==*/
.align 64
.quad 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000, 0x3fd8000000000000
/*== c1s ==*/
.align 64
.quad 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000, 0x3fe0000000000000
/*== AddB5 ==*/
.align 64
.quad 0x0000800000000000, 0x0000800000000000, 0x0000800000000000, 0x0000800000000000, 0x0000800000000000, 0x0000800000000000, 0x0000800000000000, 0x0000800000000000
/*== RcpBitMask ==*/
.align 64
.quad 0xffff000000000000, 0xffff000000000000, 0xffff000000000000, 0xffff000000000000, 0xffff000000000000, 0xffff000000000000, 0xffff000000000000, 0xffff000000000000
/*==OneEighth ==*/
.align 64
.quad 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000, 0x3fc0000000000000
/*== Four ==*/
.align 64
.quad 0x4010000000000000, 0x4010000000000000, 0x4010000000000000, 0x4010000000000000, 0x4010000000000000, 0x4010000000000000, 0x4010000000000000, 0x4010000000000000
/*== poly_coeff9 ==*/
.align 64
.quad 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368, 0xbfb9a9b040214368
/*== poly_coeff8 ==*/
.align 64
.quad 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778, 0x3fbc80666e249778
/*== poly_coeff7 ==*/
.align 64
.quad 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9, 0xbfbffffb8a054bc9
/*== poly_coeff6 ==*/
.align 64
.quad 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1, 0x3fc24922f71256f1
/*== poly_coeff5 ==*/
.align 64
.quad 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736, 0xbfc55555559ba736
/*== poly_coeff4 ==*/
.align 64
.quad 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af, 0x3fc9999999be77af
/*== poly_coeff3 ==*/
.align 64
.quad 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65, 0xbfcffffffffffc65
/*== poly_coeff2 ==*/
.align 64
.quad 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1, 0x3fd55555555554c1
/*== poly_coeff1 ==*/
.align 64
.quad 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000, 0xbfe0000000000000
/*== L2H = log(2)_high ==*/
.align 64
.quad 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000, 0x3fe62E42FEFA0000
/*== L2L = log(2)_low ==*/
.align 64
.quad 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000, 0x3d7cf79abc9e0000
.align 64
.type __svml_dacosh_data_internal_avx512,@object
.size __svml_dacosh_data_internal_avx512,.-__svml_dacosh_data_internal_avx512

View File

@ -0,0 +1,20 @@
/* AVX2 version of vectorized acoshf.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVeN16v_acoshf _ZGVeN16v_acoshf_avx2_wrapper
#include "../svml_s_acoshf16_core.S"

View File

@ -0,0 +1,28 @@
/* Multiple versions of vectorized acoshf, vector length is 16.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVeN16v_acoshf
#include "ifunc-mathvec-avx512-skx.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVeN16v_acoshf, __GI__ZGVeN16v_acoshf,
__redirect__ZGVeN16v_acoshf)
__attribute__ ((visibility ("hidden")));
#endif

View File

@ -0,0 +1,449 @@
/* Function acoshf vectorized with AVX-512.
Copyright (C) 2021 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
https://www.gnu.org/licenses/. */
/*
* ALGORITHM DESCRIPTION:
*
* Compute acosh(x) as log(x + sqrt(x*x - 1))
* using RSQRT instructions for starting the
* square root approximation, and small table lookups for log
* that map to AVX-512 permute instructions
*
* Special cases:
*
* acosh(NaN) = quiet NaN, and raise invalid exception
* acosh(-INF) = NaN
* acosh(+INF) = +INF
* acosh(x) = NaN if x < 1
* acosh(1) = +0
*
*/
/* Offsets for data table __svml_sacosh_data_internal_avx512
*/
#define Log_tbl_H 0
#define Log_tbl_L 128
#define One 256
#define SmallThreshold 320
#define Threshold 384
#define LargeThreshold 448
#define ca1 512
#define c2s 576
#define c1s 640
#define AddB5 704
#define RcpBitMask 768
#define OneEighth 832
#define Four 896
#define poly_coeff3 960
#define poly_coeff2 1024
#define poly_coeff1 1088
#define L2H 1152
#define L2L 1216
#include <sysdep.h>
.text
.section .text.exex512,"ax",@progbits
ENTRY(_ZGVeN16v_acoshf_skx)
pushq %rbp
cfi_def_cfa_offset(16)
movq %rsp, %rbp
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
andq $-64, %rsp
subq $192, %rsp
vmovups One+__svml_sacosh_data_internal_avx512(%rip), %zmm1
/*
* sqrt(1+x^2) ~ Sh + Sl + Sh*Eh*poly_s
* poly_s = c1+c2*Eh
*/
vmovups c2s+__svml_sacosh_data_internal_avx512(%rip), %zmm13
vmovups c1s+__svml_sacosh_data_internal_avx512(%rip), %zmm15
/* polynomial computation for small inputs */
vmovups ca1+__svml_sacosh_data_internal_avx512(%rip), %zmm9
/* very large inputs ? */
vmovups Threshold+__svml_sacosh_data_internal_avx512(%rip), %zmm10
/* out of range inputs? */
vmovups LargeThreshold+__svml_sacosh_data_internal_avx512(%rip), %zmm11
/* not a very small input ? */
vmovups SmallThreshold+__svml_sacosh_data_internal_avx512(%rip), %zmm6
vmovaps %zmm0, %zmm8
/* x^2 - 1 */
vmovaps %zmm1, %zmm7
vfmsub231ps {rn-sae}, %zmm8, %zmm8, %zmm7
vcmpps $21, {sae}, %zmm10, %zmm8, %k2
vcmpps $22, {sae}, %zmm11, %zmm8, %k0
vcmpps $18, {sae}, %zmm1, %zmm8, %k1
vrsqrt14ps %zmm7, %zmm12
vcmpps $21, {sae}, %zmm6, %zmm7, %k3
vmulps {rn-sae}, %zmm9, %zmm7, %zmm4
/* Sh ~sqrt(-1+x^2) */
vmulps {rn-sae}, %zmm12, %zmm7, %zmm5
/* Sh+x */
vaddps {rn-sae}, %zmm8, %zmm5, %zmm9
/* (Yh*R0)_low */
vmovaps %zmm7, %zmm0
korw %k0, %k1, %k0
/* rel. error term: Eh=1-Sh*R0 */
vmovaps %zmm1, %zmm14
vfmsub213ps {rn-sae}, %zmm5, %zmm12, %zmm0
vfnmadd231ps {rn-sae}, %zmm5, %zmm12, %zmm14
/* rel. error term: Eh=(1-Sh*R0)-Sl*R0 */
vfnmadd231ps {rn-sae}, %zmm0, %zmm12, %zmm14
/* Sh*Eh */
vmulps {rn-sae}, %zmm14, %zmm5, %zmm3
vfmadd231ps {rn-sae}, %zmm14, %zmm13, %zmm15
/* Sl + Sh*Eh*poly_s */
vfmadd213ps {rn-sae}, %zmm0, %zmm15, %zmm3
/* Shh */
vsubps {rn-sae}, %zmm8, %zmm9, %zmm15
/* polynomial computation for small inputs */
vaddps {rn-sae}, %zmm3, %zmm5, %zmm0
/* Xin0+Sl+Sh*Eh*poly_s ~ x+sqrt(1+x^2) */
vaddps {rn-sae}, %zmm3, %zmm9, %zmm2
/* Shl */
vsubps {rn-sae}, %zmm15, %zmm5, %zmm10
vfmadd231ps {rn-sae}, %zmm0, %zmm4, %zmm0
/* fixup for very large inputs */
vmovups OneEighth+__svml_sacosh_data_internal_avx512(%rip), %zmm4
/* Sl_high */
vsubps {rn-sae}, %zmm9, %zmm2, %zmm5
/* polynomial */
vmovups poly_coeff3+__svml_sacosh_data_internal_avx512(%rip), %zmm9
vmulps {rn-sae}, %zmm4, %zmm8, %zmm2{%k2}
/* -K*L2L + Tl */
vmovups L2L+__svml_sacosh_data_internal_avx512(%rip), %zmm4
/* Sl_l */
vsubps {rn-sae}, %zmm5, %zmm3, %zmm3
vrcp14ps %zmm2, %zmm11
vmovups Log_tbl_L+__svml_sacosh_data_internal_avx512(%rip), %zmm5
/* Xin_low */
vaddps {rn-sae}, %zmm10, %zmm3, %zmm13
/* round reciprocal to 1+4b mantissas */
vpaddd AddB5+__svml_sacosh_data_internal_avx512(%rip), %zmm11, %zmm12
vmovups poly_coeff1+__svml_sacosh_data_internal_avx512(%rip), %zmm10
vandps RcpBitMask+__svml_sacosh_data_internal_avx512(%rip), %zmm12, %zmm14
/* fixup for very large inputs */
vxorps %zmm13, %zmm13, %zmm13{%k2}
/* reduced argument for log(): (Rcp*Xin-1)+Rcp*Xin_low */
vfmsub231ps {rn-sae}, %zmm14, %zmm2, %zmm1
/* exponents */
vgetexpps {sae}, %zmm14, %zmm12
vmovups Four+__svml_sacosh_data_internal_avx512(%rip), %zmm2
/* Prepare table index */
vpsrld $18, %zmm14, %zmm3
vfmadd231ps {rn-sae}, %zmm14, %zmm13, %zmm1
vmovups poly_coeff2+__svml_sacosh_data_internal_avx512(%rip), %zmm13
/* Table lookups */
vmovups __svml_sacosh_data_internal_avx512(%rip), %zmm14
vsubps {rn-sae}, %zmm2, %zmm12, %zmm12{%k2}
vpermt2ps Log_tbl_L+64+__svml_sacosh_data_internal_avx512(%rip), %zmm3, %zmm5
vpermt2ps Log_tbl_H+64+__svml_sacosh_data_internal_avx512(%rip), %zmm3, %zmm14
/* R^2 */
vmulps {rn-sae}, %zmm1, %zmm1, %zmm11
/* -K*L2H + Th */
vmovups L2H+__svml_sacosh_data_internal_avx512(%rip), %zmm2
vfmadd231ps {rn-sae}, %zmm1, %zmm9, %zmm13
vfnmadd231ps {rn-sae}, %zmm12, %zmm2, %zmm14
vfnmadd213ps {rn-sae}, %zmm5, %zmm4, %zmm12
vfmadd213ps {rn-sae}, %zmm10, %zmm1, %zmm13
/* Tl + R^2*Poly */
vfmadd213ps {rn-sae}, %zmm12, %zmm11, %zmm13
/* R+Tl + R^2*Poly */
vaddps {rn-sae}, %zmm1, %zmm13, %zmm1
vaddps {rn-sae}, %zmm1, %zmm14, %zmm0{%k3}
/* Go to special inputs processing branch */
jne L(SPECIAL_VALUES_BRANCH)
# LOE rbx r12 r13 r14 r15 k0 zmm0 zmm8
/* Restore registers
* and exit the function
*/
L(EXIT):
movq %rbp, %rsp
popq %rbp
cfi_def_cfa(7, 8)
cfi_restore(6)
ret
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
/* Branch to process
* special inputs
*/
L(SPECIAL_VALUES_BRANCH):
vmovups %zmm8, 64(%rsp)
vmovups %zmm0, 128(%rsp)
# LOE rbx r12 r13 r14 r15 k0 zmm0
xorl %eax, %eax
# LOE rbx r12 r13 r14 r15 eax k0
vzeroupper
movq %r12, 16(%rsp)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -176; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x50, 0xff, 0xff, 0xff, 0x22
movl %eax, %r12d
movq %r13, 8(%rsp)
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
kmovd %k0, %r13d
movq %r14, (%rsp)
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
# LOE rbx r15 r12d r13d
/* Range mask
* bits check
*/
L(RANGEMASK_CHECK):
btl %r12d, %r13d
/* Call scalar math function */
jc L(SCALAR_MATH_CALL)
# LOE rbx r15 r12d r13d
/* Special inputs
* processing loop
*/
L(SPECIAL_VALUES_LOOP):
incl %r12d
cmpl $16, %r12d
/* Check bits in range mask */
jl L(RANGEMASK_CHECK)
# LOE rbx r15 r12d r13d
movq 16(%rsp), %r12
cfi_restore(12)
movq 8(%rsp), %r13
cfi_restore(13)
movq (%rsp), %r14
cfi_restore(14)
vmovups 128(%rsp), %zmm0
/* Go to exit */
jmp L(EXIT)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -176; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x50, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -64; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
# LOE rbx r12 r13 r14 r15 zmm0
/* Scalar math fucntion call
* to process special input
*/
L(SCALAR_MATH_CALL):
movl %r12d, %r14d
movss 64(%rsp,%r14,4), %xmm0
call acoshf@PLT
# LOE rbx r14 r15 r12d r13d xmm0
movss %xmm0, 128(%rsp,%r14,4)
/* Process special inputs in loop */
jmp L(SPECIAL_VALUES_LOOP)
# LOE rbx r15 r12d r13d
END(_ZGVeN16v_acoshf_skx)
.section .rodata, "a"
.align 64
#ifdef __svml_sacosh_data_internal_avx512_typedef
typedef unsigned int VUINT32;
typedef struct {
__declspec(align(64)) VUINT32 Log_tbl_H[32][1];
__declspec(align(64)) VUINT32 Log_tbl_L[32][1];
__declspec(align(64)) VUINT32 One[16][1];
__declspec(align(64)) VUINT32 SmallThreshold[16][1];
__declspec(align(64)) VUINT32 Threshold[16][1];
__declspec(align(64)) VUINT32 LargeThreshold[16][1];
__declspec(align(64)) VUINT32 ca1[16][1];
__declspec(align(64)) VUINT32 c2s[16][1];
__declspec(align(64)) VUINT32 c1s[16][1];
__declspec(align(64)) VUINT32 AddB5[16][1];
__declspec(align(64)) VUINT32 RcpBitMask[16][1];
__declspec(align(64)) VUINT32 OneEighth[16][1];
__declspec(align(64)) VUINT32 Four[16][1];
__declspec(align(64)) VUINT32 poly_coeff3[16][1];
__declspec(align(64)) VUINT32 poly_coeff2[16][1];
__declspec(align(64)) VUINT32 poly_coeff1[16][1];
__declspec(align(64)) VUINT32 L2H[16][1];
__declspec(align(64)) VUINT32 L2L[16][1];
} __svml_sacosh_data_internal_avx512;
#endif
__svml_sacosh_data_internal_avx512:
/*== Log_tbl_H ==*/
.long 0x00000000
.long 0xbcfc0000
.long 0xbd788000
.long 0xbdb78000
.long 0xbdf14000
.long 0xbe14a000
.long 0xbe300000
.long 0xbe4aa000
.long 0xbe648000
.long 0xbe7dc000
.long 0xbe8b4000
.long 0xbe974000
.long 0xbea31000
.long 0xbeae9000
.long 0xbeb9d000
.long 0xbec4d000
.long 0xbecfa000
.long 0xbeda2000
.long 0xbee48000
.long 0xbeeea000
.long 0xbef89000
.long 0xbf012800
.long 0xbf05f000
.long 0xbf0aa800
.long 0xbf0f4000
.long 0xbf13c800
.long 0xbf184000
.long 0xbf1ca000
.long 0xbf20f000
.long 0xbf252800
.long 0xbf295000
.long 0xbf2d6800
/*== Log_tbl_L ==*/
.align 64
.long 0x80000000
.long 0xb726c39e
.long 0x3839e7fe
.long 0xb7528ae5
.long 0x377891d5
.long 0xb8297c10
.long 0x37cf8f58
.long 0x3852b186
.long 0x35838656
.long 0xb80c36af
.long 0x38235454
.long 0xb862bae1
.long 0x37e87bc7
.long 0x37848150
.long 0x37202511
.long 0xb74e1b05
.long 0x385c1340
.long 0xb8777bcd
.long 0x36038656
.long 0xb7d40984
.long 0xb80f5faf
.long 0xb8254b4c
.long 0xb865c84a
.long 0x37f0b42d
.long 0xb83ebce1
.long 0xb83c2513
.long 0x37a332c4
.long 0x3779654f
.long 0x38602f73
.long 0x367449f8
.long 0xb7b4996f
.long 0xb800986b
/*== One ==*/
.align 64
.long 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000
/*== SmallThreshold ==*/
.align 64
.long 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000, 0x39800000
/*== Threshold ==*/
.align 64
.long 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000, 0x5f000000
/*== LargeThreshold ==*/
.align 64
.long 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff
/*== ca1 ==*/
.align 64
.long 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE, 0xbe2AA5DE
/*== c2s ==*/
.align 64
.long 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000, 0x3ec00000
/*== c1s ==*/
.align 64
.long 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000
/*== AddB5 ==*/
.align 64
.long 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000
/*== RcpBitMask ==*/
.align 64
.long 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000
/*==OneEighth ==*/
.align 64
.long 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000, 0x3e000000
/*== Four ==*/
.align 64
.long 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40800000
/*== poly_coeff3 ==*/
.align 64
.long 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810, 0xbe800810
/*== poly_coeff2 ==*/
.align 64
.long 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e, 0x3eaab11e
/*== poly_coeff1 ==*/
.align 64
.long 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000
/*== L2H = log(2)_high ==*/
.align 64
.long 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000, 0x3f317000
/*== L2L = log(2)_low ==*/
.align 64
.long 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4, 0x3805fdf4
.align 64
.type __svml_sacosh_data_internal_avx512,@object
.size __svml_sacosh_data_internal_avx512,.-__svml_sacosh_data_internal_avx512

View File

@ -0,0 +1,20 @@
/* SSE2 version of vectorized acoshf, vector length is 4.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVbN4v_acoshf _ZGVbN4v_acoshf_sse2
#include "../svml_s_acoshf4_core.S"

View File

@ -0,0 +1,28 @@
/* Multiple versions of vectorized acoshf, vector length is 4.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVbN4v_acoshf
#include "ifunc-mathvec-sse4_1.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVbN4v_acoshf, __GI__ZGVbN4v_acoshf,
__redirect__ZGVbN4v_acoshf)
__attribute__ ((visibility ("hidden")));
#endif

View File

@ -0,0 +1,389 @@
/* Function acoshf vectorized with SSE4.
Copyright (C) 2021 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
https://www.gnu.org/licenses/. */
/*
* ALGORITHM DESCRIPTION:
*
* Compute acosh(x) as log(x + sqrt(x*x - 1))
*
* Special cases:
*
* acosh(NaN) = quiet NaN, and raise invalid exception
* acosh(-INF) = NaN
* acosh(+INF) = +INF
* acosh(x) = NaN if x < 1
* acosh(1) = +0
*
*/
/* Offsets for data table __svml_sacosh_data_internal
*/
#define sOne 0
#define sPoly 16
#define iBrkValue 144
#define iOffExpoMask 160
#define sBigThreshold 176
#define sC2 192
#define sC3 208
#define sHalf 224
#define sLargestFinite 240
#define sThirtyOne 256
#define sTopMask8 272
#define XScale 288
#define sLn2 304
#include <sysdep.h>
.text
.section .text.sse4,"ax",@progbits
ENTRY(_ZGVbN4v_acoshf_sse4)
subq $72, %rsp
cfi_def_cfa_offset(80)
/* Compute U = X - 1 and V = X + 1, naively first. */
movaps %xmm0, %xmm12
/* Load constants, always including One = 1 */
movups sOne+__svml_sacosh_data_internal(%rip), %xmm2
/*
* Check that 1 < X < +inf; otherwise go to the callout function.
* We need the callout for X = 1 to avoid division by zero below.
* This test ensures that callout handles NaN and either infinity.
*/
movaps %xmm0, %xmm4
movaps %xmm2, %xmm9
/*
* Compute e = -(2 * d + d^2)
* The first FMR is exact, and the rounding error in the other is acceptable
* since d and e are ~ 2^-8
*/
movaps %xmm2, %xmm10
/* Finally, express Y + W = U * V accurately where Y has <= 8 bits */
movups sTopMask8+__svml_sacosh_data_internal(%rip), %xmm5
/*
* Now we feed into the log1p code, using H in place of _VARG1 and
* also adding L into Xl.
* compute 1+x as high, low parts
*/
movaps %xmm2, %xmm13
movaps %xmm5, %xmm11
movaps %xmm2, %xmm3
/*
* Now 1 / (1 + d)
* = 1 / (1 + (sqrt(1 - e) - 1))
* = 1 / sqrt(1 - e)
* = 1 + 1/2 * e + 3/8 * e^2 + 5/16 * e^3 + 35/128 * e^4 + ...
* So compute the first three nonconstant terms of that, so that
* we have a relative correction (1 + Corr) to apply to S etc.
* C1 = 1/2
* C2 = 3/8
* C3 = 5/16
*/
movups sC3+__svml_sacosh_data_internal(%rip), %xmm8
/*
* The following computation can go wrong for very large X, e.g.
* the X^2 - 1 = U * V can overflow. But for large X we have
* acosh(X) / log(2 X) - 1 =~= 1/(4 * X^2), so for X >= 2^30
* we can just later stick X back into the log and tweak up the exponent.
* Actually we scale X by 2^-30 and tweak the exponent up by 31,
* to stay in the safe range for the later log computation.
* Compute a flag now telling us when to do this.
*/
movaps %xmm0, %xmm1
cmpnleps sLargestFinite+__svml_sacosh_data_internal(%rip), %xmm4
cmpltps sBigThreshold+__svml_sacosh_data_internal(%rip), %xmm1
cmpnltps %xmm0, %xmm3
subps %xmm2, %xmm12
addps %xmm0, %xmm9
/* For low-accuracy versions, naivety is harmless */
mulps %xmm12, %xmm9
orps %xmm3, %xmm4
movmskps %xmm4, %edx
andps %xmm9, %xmm11
movaps %xmm1, %xmm3
/*
* Compute R = 1/sqrt(Y + W) * (1 + d)
* Force R to <= 8 significant bits.
* This means that R * Y and R^2 * Y are exactly representable.
*/
rsqrtps %xmm11, %xmm7
subps %xmm11, %xmm9
andps %xmm5, %xmm7
movaps %xmm2, %xmm4
/*
* Compute S = (Y/sqrt(Y + W)) * (1 + d)
* and T = (W/sqrt(Y + W)) * (1 + d)
* so that S + T = sqrt(Y + W) * (1 + d)
* S is exact, and the rounding error in T is OK.
*/
mulps %xmm7, %xmm11
movaps %xmm7, %xmm6
mulps %xmm7, %xmm9
mulps %xmm11, %xmm6
mulps %xmm9, %xmm7
/*
* For low-accuracy versions, the computation can be done
* just as U + ((S + T) + (S + T) * Corr)
*/
addps %xmm9, %xmm11
subps %xmm6, %xmm10
movaps %xmm2, %xmm9
subps %xmm7, %xmm10
mulps %xmm10, %xmm8
/* Now multiplex to the case X = 2^-30 * input, Xl = 0 in the "big" case. */
movups XScale+__svml_sacosh_data_internal(%rip), %xmm14
mulps %xmm0, %xmm14
addps sC2+__svml_sacosh_data_internal(%rip), %xmm8
mulps %xmm10, %xmm8
andnps %xmm14, %xmm3
/*
* Now resume the main code.
* reduction: compute r,n
*/
movdqu iBrkValue+__svml_sacosh_data_internal(%rip), %xmm14
movdqu iOffExpoMask+__svml_sacosh_data_internal(%rip), %xmm5
/* Add 31 to the exponent in the "large" case to get log(2 * input) */
movups sThirtyOne+__svml_sacosh_data_internal(%rip), %xmm6
addps sHalf+__svml_sacosh_data_internal(%rip), %xmm8
mulps %xmm8, %xmm10
movaps %xmm1, %xmm8
mulps %xmm11, %xmm10
addps %xmm10, %xmm11
addps %xmm11, %xmm12
maxps %xmm12, %xmm13
minps %xmm12, %xmm9
movaps %xmm13, %xmm15
addps %xmm9, %xmm15
subps %xmm15, %xmm13
andps %xmm1, %xmm15
orps %xmm15, %xmm3
addps %xmm13, %xmm9
psubd %xmm14, %xmm3
andps %xmm1, %xmm9
pand %xmm3, %xmm5
psrad $23, %xmm3
cvtdq2ps %xmm3, %xmm7
pslld $23, %xmm3
paddd %xmm14, %xmm5
psubd %xmm3, %xmm4
/* polynomial evaluation */
subps %xmm2, %xmm5
mulps %xmm4, %xmm9
addps %xmm7, %xmm6
movups sPoly+112+__svml_sacosh_data_internal(%rip), %xmm2
andnps %xmm6, %xmm8
andps %xmm1, %xmm7
addps %xmm5, %xmm9
mulps %xmm9, %xmm2
orps %xmm7, %xmm8
/* final reconstruction */
mulps sLn2+__svml_sacosh_data_internal(%rip), %xmm8
addps sPoly+96+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+80+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+64+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+48+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+32+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+16+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
addps sPoly+__svml_sacosh_data_internal(%rip), %xmm2
mulps %xmm9, %xmm2
mulps %xmm9, %xmm2
addps %xmm2, %xmm9
addps %xmm8, %xmm9
testl %edx, %edx
/* Go to special inputs processing branch */
jne L(SPECIAL_VALUES_BRANCH)
# LOE rbx rbp r12 r13 r14 r15 edx xmm0 xmm9
/* Restore registers
* and exit the function
*/
L(EXIT):
movaps %xmm9, %xmm0
addq $72, %rsp
cfi_def_cfa_offset(8)
ret
cfi_def_cfa_offset(80)
/* Branch to process
* special inputs
*/
L(SPECIAL_VALUES_BRANCH):
movups %xmm0, 32(%rsp)
movups %xmm9, 48(%rsp)
# LOE rbx rbp r12 r13 r14 r15 edx
xorl %eax, %eax
movq %r12, 16(%rsp)
cfi_offset(12, -64)
movl %eax, %r12d
movq %r13, 8(%rsp)
cfi_offset(13, -72)
movl %edx, %r13d
movq %r14, (%rsp)
cfi_offset(14, -80)
# LOE rbx rbp r15 r12d r13d
/* Range mask
* bits check
*/
L(RANGEMASK_CHECK):
btl %r12d, %r13d
/* Call scalar math function */
jc L(SCALAR_MATH_CALL)
# LOE rbx rbp r15 r12d r13d
/* Special inputs
* processing loop
*/
L(SPECIAL_VALUES_LOOP):
incl %r12d
cmpl $4, %r12d
/* Check bits in range mask */
jl L(RANGEMASK_CHECK)
# LOE rbx rbp r15 r12d r13d
movq 16(%rsp), %r12
cfi_restore(12)
movq 8(%rsp), %r13
cfi_restore(13)
movq (%rsp), %r14
cfi_restore(14)
movups 48(%rsp), %xmm9
/* Go to exit */
jmp L(EXIT)
cfi_offset(12, -64)
cfi_offset(13, -72)
cfi_offset(14, -80)
# LOE rbx rbp r12 r13 r14 r15 xmm9
/* Scalar math fucntion call
* to process special input
*/
L(SCALAR_MATH_CALL):
movl %r12d, %r14d
movss 32(%rsp,%r14,4), %xmm0
call acoshf@PLT
# LOE rbx rbp r14 r15 r12d r13d xmm0
movss %xmm0, 48(%rsp,%r14,4)
/* Process special inputs in loop */
jmp L(SPECIAL_VALUES_LOOP)
# LOE rbx rbp r15 r12d r13d
END(_ZGVbN4v_acoshf_sse4)
.section .rodata, "a"
.align 16
#ifdef __svml_sacosh_data_internal_typedef
typedef unsigned int VUINT32;
typedef struct {
__declspec(align(16)) VUINT32 sOne[4][1];
__declspec(align(16)) VUINT32 sPoly[8][4][1];
__declspec(align(16)) VUINT32 iBrkValue[4][1];
__declspec(align(16)) VUINT32 iOffExpoMask[4][1];
__declspec(align(16)) VUINT32 sBigThreshold[4][1];
__declspec(align(16)) VUINT32 sC2[4][1];
__declspec(align(16)) VUINT32 sC3[4][1];
__declspec(align(16)) VUINT32 sHalf[4][1];
__declspec(align(16)) VUINT32 sLargestFinite[4][1];
__declspec(align(16)) VUINT32 sThirtyOne[4][1];
__declspec(align(16)) VUINT32 sTopMask8[4][1];
__declspec(align(16)) VUINT32 XScale[4][1];
__declspec(align(16)) VUINT32 sLn2[4][1];
} __svml_sacosh_data_internal;
#endif
__svml_sacosh_data_internal:
/*== sOne = SP 1.0 ==*/
.long 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000
/*== sPoly[] = SP polynomial ==*/
.align 16
.long 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000 /* -5.0000000000000000000000000e-01 P0 */
.long 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94 /* 3.3333265781402587890625000e-01 P1 */
.long 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e /* -2.5004237890243530273437500e-01 P2 */
.long 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190 /* 2.0007920265197753906250000e-01 P3 */
.long 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37 /* -1.6472326219081878662109375e-01 P4 */
.long 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12 /* 1.4042308926582336425781250e-01 P5 */
.long 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3 /* -1.5122179687023162841796875e-01 P6 */
.long 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed /* 1.3820238411426544189453125e-01 P7 */
/*== iBrkValue = SP 2/3 ==*/
.align 16
.long 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab
/*== iOffExpoMask = SP significand mask ==*/
.align 16
.long 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff
/*== sBigThreshold ==*/
.align 16
.long 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000
/*== sC2 ==*/
.align 16
.long 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000
/*== sC3 ==*/
.align 16
.long 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000
/*== sHalf ==*/
.align 16
.long 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000
/*== sLargestFinite ==*/
.align 16
.long 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF
/*== sThirtyOne ==*/
.align 16
.long 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000
/*== sTopMask8 ==*/
.align 16
.long 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000
/*== XScale ==*/
.align 16
.long 0x30800000, 0x30800000, 0x30800000, 0x30800000
/*== sLn2 = SP ln(2) ==*/
.align 16
.long 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218
.align 16
.type __svml_sacosh_data_internal,@object
.size __svml_sacosh_data_internal,.-__svml_sacosh_data_internal

View File

@ -0,0 +1,20 @@
/* SSE version of vectorized acoshf, vector length is 8.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define _ZGVdN8v_acoshf _ZGVdN8v_acoshf_sse_wrapper
#include "../svml_s_acoshf8_core.S"

View File

@ -0,0 +1,28 @@
/* Multiple versions of vectorized acoshf, vector length is 8.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#define SYMBOL_NAME _ZGVdN8v_acoshf
#include "ifunc-mathvec-avx2.h"
libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
#ifdef SHARED
__hidden_ver1 (_ZGVdN8v_acoshf, __GI__ZGVdN8v_acoshf,
__redirect__ZGVdN8v_acoshf)
__attribute__ ((visibility ("hidden")));
#endif

View File

@ -0,0 +1,370 @@
/* Function acoshf vectorized with AVX2.
Copyright (C) 2021 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
https://www.gnu.org/licenses/. */
/*
* ALGORITHM DESCRIPTION:
*
* Compute acosh(x) as log(x + sqrt(x*x - 1))
*
* Special cases:
*
* acosh(NaN) = quiet NaN, and raise invalid exception
* acosh(-INF) = NaN
* acosh(+INF) = +INF
* acosh(x) = NaN if x < 1
* acosh(1) = +0
*
*/
/* Offsets for data table __svml_sacosh_data_internal
*/
#define sOne 0
#define sPoly 32
#define iBrkValue 288
#define iOffExpoMask 320
#define sBigThreshold 352
#define sC2 384
#define sC3 416
#define sHalf 448
#define sLargestFinite 480
#define sThirtyOne 512
#define sTopMask8 544
#define XScale 576
#define sLn2 608
#include <sysdep.h>
.text
.section .text.avx2,"ax",@progbits
ENTRY(_ZGVdN8v_acoshf_avx2)
pushq %rbp
cfi_def_cfa_offset(16)
movq %rsp, %rbp
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
andq $-32, %rsp
subq $96, %rsp
/* Load constants, always including One = 1 */
vmovups sOne+__svml_sacosh_data_internal(%rip), %ymm2
/* Finally, express Y + W = U * V accurately where Y has <= 8 bits */
vmovups sTopMask8+__svml_sacosh_data_internal(%rip), %ymm9
/*
* Now 1 / (1 + d)
* = 1 / (1 + (sqrt(1 - e) - 1))
* = 1 / sqrt(1 - e)
* = 1 + 1/2 * e + 3/8 * e^2 + 5/16 * e^3 + 35/128 * e^4 + ...
* So compute the first three nonconstant terms of that, so that
* we have a relative correction (1 + Corr) to apply to S etc.
* C1 = 1/2
* C2 = 3/8
* C3 = 5/16
*/
vmovups sC3+__svml_sacosh_data_internal(%rip), %ymm14
vmovaps %ymm0, %ymm3
vmovaps %ymm2, %ymm7
vfmsub231ps %ymm3, %ymm3, %ymm7
/*
* Check that 1 < X < +inf; otherwise go to the callout function.
* We need the callout for X = 1 to avoid division by zero below.
* This test ensures that callout handles NaN and either infinity.
*/
vcmpnle_uqps sLargestFinite+__svml_sacosh_data_internal(%rip), %ymm3, %ymm4
vcmpngt_uqps %ymm2, %ymm3, %ymm5
/*
* The following computation can go wrong for very large X, e.g.
* the X^2 - 1 = U * V can overflow. But for large X we have
* acosh(X) / log(2 X) - 1 =~= 1/(4 * X^2), so for X >= 2^30
* we can just later stick X back into the log and tweak up the exponent.
* Actually we scale X by 2^-30 and tweak the exponent up by 31,
* to stay in the safe range for the later log computation.
* Compute a flag now telling us when to do this.
*/
vcmplt_oqps sBigThreshold+__svml_sacosh_data_internal(%rip), %ymm3, %ymm1
vandps %ymm9, %ymm7, %ymm10
/*
* Compute R = 1/sqrt(Y + W) * (1 + d)
* Force R to <= 8 significant bits.
* This means that R * Y and R^2 * Y are exactly representable.
*/
vrsqrtps %ymm10, %ymm8
vsubps %ymm10, %ymm7, %ymm11
vandps %ymm9, %ymm8, %ymm12
/*
* Compute S = (Y/sqrt(Y + W)) * (1 + d)
* and T = (W/sqrt(Y + W)) * (1 + d)
* so that S + T = sqrt(Y + W) * (1 + d)
* S is exact, and the rounding error in T is OK.
*/
vmulps %ymm12, %ymm10, %ymm15
vmulps %ymm11, %ymm12, %ymm0
/* Now multiplex to the case X = 2^-30 * input, Xl = 0 in the "big" case. */
vmulps XScale+__svml_sacosh_data_internal(%rip), %ymm3, %ymm11
/*
* Compute e = -(2 * d + d^2)
* The first FMR is exact, and the rounding error in the other is acceptable
* since d and e are ~ 2^-8
*/
vmovaps %ymm2, %ymm13
vfnmadd231ps %ymm15, %ymm12, %ymm13
vfnmadd231ps %ymm0, %ymm12, %ymm13
vfmadd213ps sC2+__svml_sacosh_data_internal(%rip), %ymm13, %ymm14
vfmadd213ps sHalf+__svml_sacosh_data_internal(%rip), %ymm13, %ymm14
vmulps %ymm14, %ymm13, %ymm7
vorps %ymm5, %ymm4, %ymm6
/*
* For low-accuracy versions, the computation can be done
* just as U + ((S + T) + (S + T) * Corr)
*/
vaddps %ymm0, %ymm15, %ymm5
/* sU is needed later on */
vsubps %ymm2, %ymm3, %ymm4
vfmadd213ps %ymm5, %ymm7, %ymm5
vmovmskps %ymm6, %edx
vaddps %ymm5, %ymm4, %ymm6
/*
* Now resume the main code.
* reduction: compute r,n
*/
vmovups iBrkValue+__svml_sacosh_data_internal(%rip), %ymm4
/*
* Now we feed into the log1p code, using H in place of _VARG1 and
* also adding L into Xl.
* compute 1+x as high, low parts
*/
vmaxps %ymm6, %ymm2, %ymm8
vminps %ymm6, %ymm2, %ymm9
vaddps %ymm9, %ymm8, %ymm12
vblendvps %ymm1, %ymm12, %ymm11, %ymm14
vsubps %ymm12, %ymm8, %ymm10
vpsubd %ymm4, %ymm14, %ymm15
vaddps %ymm10, %ymm9, %ymm13
vpand iOffExpoMask+__svml_sacosh_data_internal(%rip), %ymm15, %ymm14
vpsrad $23, %ymm15, %ymm15
vpaddd %ymm4, %ymm14, %ymm8
vpslld $23, %ymm15, %ymm5
vmovups sPoly+224+__svml_sacosh_data_internal(%rip), %ymm4
vcvtdq2ps %ymm15, %ymm0
vpsubd %ymm5, %ymm2, %ymm7
/* polynomial evaluation */
vsubps %ymm2, %ymm8, %ymm2
/* Add 31 to the exponent in the "large" case to get log(2 * input) */
vaddps sThirtyOne+__svml_sacosh_data_internal(%rip), %ymm0, %ymm5
vandps %ymm1, %ymm13, %ymm6
vmulps %ymm7, %ymm6, %ymm9
vblendvps %ymm1, %ymm0, %ymm5, %ymm0
vaddps %ymm2, %ymm9, %ymm2
vfmadd213ps sPoly+192+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+160+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+128+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+96+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+64+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+32+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vfmadd213ps sPoly+__svml_sacosh_data_internal(%rip), %ymm2, %ymm4
vmulps %ymm4, %ymm2, %ymm6
vfmadd213ps %ymm2, %ymm2, %ymm6
/* final reconstruction */
vfmadd132ps sLn2+__svml_sacosh_data_internal(%rip), %ymm6, %ymm0
testl %edx, %edx
/* Go to special inputs processing branch */
jne L(SPECIAL_VALUES_BRANCH)
# LOE rbx r12 r13 r14 r15 edx ymm0 ymm3
/* Restore registers
* and exit the function
*/
L(EXIT):
movq %rbp, %rsp
popq %rbp
cfi_def_cfa(7, 8)
cfi_restore(6)
ret
cfi_def_cfa(6, 16)
cfi_offset(6, -16)
/* Branch to process
* special inputs
*/
L(SPECIAL_VALUES_BRANCH):
vmovups %ymm3, 32(%rsp)
vmovups %ymm0, 64(%rsp)
# LOE rbx r12 r13 r14 r15 edx ymm0
xorl %eax, %eax
# LOE rbx r12 r13 r14 r15 eax edx
vzeroupper
movq %r12, 16(%rsp)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -80; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xb0, 0xff, 0xff, 0xff, 0x22
movl %eax, %r12d
movq %r13, 8(%rsp)
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -88; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xa8, 0xff, 0xff, 0xff, 0x22
movl %edx, %r13d
movq %r14, (%rsp)
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -96; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xa0, 0xff, 0xff, 0xff, 0x22
# LOE rbx r15 r12d r13d
/* Range mask
* bits check
*/
L(RANGEMASK_CHECK):
btl %r12d, %r13d
/* Call scalar math function */
jc L(SCALAR_MATH_CALL)
# LOE rbx r15 r12d r13d
/* Special inputs
* processing loop
*/
L(SPECIAL_VALUES_LOOP):
incl %r12d
cmpl $8, %r12d
/* Check bits in range mask */
jl L(RANGEMASK_CHECK)
# LOE rbx r15 r12d r13d
movq 16(%rsp), %r12
cfi_restore(12)
movq 8(%rsp), %r13
cfi_restore(13)
movq (%rsp), %r14
cfi_restore(14)
vmovups 64(%rsp), %ymm0
/* Go to exit */
jmp L(EXIT)
/* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -80; DW_OP_plus) */
.cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xb0, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -88; DW_OP_plus) */
.cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xa8, 0xff, 0xff, 0xff, 0x22
/* DW_CFA_expression: r14 (r14) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -96; DW_OP_plus) */
.cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xa0, 0xff, 0xff, 0xff, 0x22
# LOE rbx r12 r13 r14 r15 ymm0
/* Scalar math fucntion call
* to process special input
*/
L(SCALAR_MATH_CALL):
movl %r12d, %r14d
movss 32(%rsp,%r14,4), %xmm0
call acoshf@PLT
# LOE rbx r14 r15 r12d r13d xmm0
movss %xmm0, 64(%rsp,%r14,4)
/* Process special inputs in loop */
jmp L(SPECIAL_VALUES_LOOP)
# LOE rbx r15 r12d r13d
END(_ZGVdN8v_acoshf_avx2)
.section .rodata, "a"
.align 32
#ifdef __svml_sacosh_data_internal_typedef
typedef unsigned int VUINT32;
typedef struct {
__declspec(align(32)) VUINT32 sOne[8][1];
__declspec(align(32)) VUINT32 sPoly[8][8][1];
__declspec(align(32)) VUINT32 iBrkValue[8][1];
__declspec(align(32)) VUINT32 iOffExpoMask[8][1];
__declspec(align(32)) VUINT32 sBigThreshold[8][1];
__declspec(align(32)) VUINT32 sC2[8][1];
__declspec(align(32)) VUINT32 sC3[8][1];
__declspec(align(32)) VUINT32 sHalf[8][1];
__declspec(align(32)) VUINT32 sLargestFinite[8][1];
__declspec(align(32)) VUINT32 sThirtyOne[8][1];
__declspec(align(32)) VUINT32 sTopMask8[8][1];
__declspec(align(32)) VUINT32 XScale[8][1];
__declspec(align(32)) VUINT32 sLn2[8][1];
} __svml_sacosh_data_internal;
#endif
__svml_sacosh_data_internal:
/*== sOne = SP 1.0 ==*/
.long 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000
/*== sPoly[] = SP polynomial ==*/
.align 32
.long 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000, 0xbf000000 /* -5.0000000000000000000000000e-01 P0 */
.long 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94, 0x3eaaaa94 /* 3.3333265781402587890625000e-01 P1 */
.long 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e, 0xbe80058e /* -2.5004237890243530273437500e-01 P2 */
.long 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190, 0x3e4ce190 /* 2.0007920265197753906250000e-01 P3 */
.long 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37, 0xbe28ad37 /* -1.6472326219081878662109375e-01 P4 */
.long 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12, 0x3e0fcb12 /* 1.4042308926582336425781250e-01 P5 */
.long 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3, 0xbe1ad9e3 /* -1.5122179687023162841796875e-01 P6 */
.long 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed, 0x3e0d84ed /* 1.3820238411426544189453125e-01 P7 */
/*== iBrkValue = SP 2/3 ==*/
.align 32
.long 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab, 0x3f2aaaab
/*== iOffExpoMask = SP significand mask ==*/
.align 32
.long 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff
/*== sBigThreshold ==*/
.align 32
.long 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000, 0x4E800000
/*== sC2 ==*/
.align 32
.long 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000, 0x3EC00000
/*== sC3 ==*/
.align 32
.long 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000, 0x3EA00000
/*== sHalf ==*/
.align 32
.long 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000, 0x3F000000
/*== sLargestFinite ==*/
.align 32
.long 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF
/*== sThirtyOne ==*/
.align 32
.long 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000, 0x41F80000
/*== sTopMask8 ==*/
.align 32
.long 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000
/*== XScale ==*/
.align 32
.long 0x30800000, 0x30800000, 0x30800000, 0x30800000, 0x30800000, 0x30800000, 0x30800000, 0x30800000
/*== sLn2 = SP ln(2) ==*/
.align 32
.long 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218, 0x3f317218
.align 32
.type __svml_sacosh_data_internal,@object
.size __svml_sacosh_data_internal,.-__svml_sacosh_data_internal

View File

@ -0,0 +1,29 @@
/* Function acosh vectorized with SSE2.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_d_wrapper_impl.h"
.text
ENTRY (_ZGVbN2v_acosh)
WRAPPER_IMPL_SSE2 acosh
END (_ZGVbN2v_acosh)
#ifndef USE_MULTIARCH
libmvec_hidden_def (_ZGVbN2v_acosh)
#endif

View File

@ -0,0 +1,29 @@
/* Function acosh vectorized with AVX2, wrapper version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_d_wrapper_impl.h"
.text
ENTRY (_ZGVdN4v_acosh)
WRAPPER_IMPL_AVX _ZGVbN2v_acosh
END (_ZGVdN4v_acosh)
#ifndef USE_MULTIARCH
libmvec_hidden_def (_ZGVdN4v_acosh)
#endif

View File

@ -0,0 +1,25 @@
/* Function acosh vectorized in AVX ISA as wrapper to SSE4 ISA version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_d_wrapper_impl.h"
.text
ENTRY (_ZGVcN4v_acosh)
WRAPPER_IMPL_AVX _ZGVbN2v_acosh
END (_ZGVcN4v_acosh)

View File

@ -0,0 +1,25 @@
/* Function acosh vectorized with AVX-512, wrapper to AVX2.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_d_wrapper_impl.h"
.text
ENTRY (_ZGVeN8v_acosh)
WRAPPER_IMPL_AVX512 _ZGVdN4v_acosh
END (_ZGVeN8v_acosh)

View File

@ -0,0 +1,25 @@
/* Function acoshf vectorized with AVX-512. Wrapper to AVX2 version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_s_wrapper_impl.h"
.text
ENTRY (_ZGVeN16v_acoshf)
WRAPPER_IMPL_AVX512 _ZGVdN8v_acoshf
END (_ZGVeN16v_acoshf)

View File

@ -0,0 +1,29 @@
/* Function acoshf vectorized with SSE2, wrapper version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_s_wrapper_impl.h"
.text
ENTRY (_ZGVbN4v_acoshf)
WRAPPER_IMPL_SSE2 acoshf
END (_ZGVbN4v_acoshf)
#ifndef USE_MULTIARCH
libmvec_hidden_def (_ZGVbN4v_acoshf)
#endif

View File

@ -0,0 +1,29 @@
/* Function acoshf vectorized with AVX2, wrapper version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_s_wrapper_impl.h"
.text
ENTRY (_ZGVdN8v_acoshf)
WRAPPER_IMPL_AVX _ZGVbN4v_acoshf
END (_ZGVdN8v_acoshf)
#ifndef USE_MULTIARCH
libmvec_hidden_def (_ZGVdN8v_acoshf)
#endif

View File

@ -0,0 +1,25 @@
/* Function acoshf vectorized in AVX ISA as wrapper to SSE4 ISA version.
Copyright (C) 2021 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
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include "svml_s_wrapper_impl.h"
.text
ENTRY (_ZGVcN8v_acoshf)
WRAPPER_IMPL_AVX _ZGVbN4v_acoshf
END (_ZGVcN8v_acoshf)

View File

@ -0,0 +1 @@
#include "test-double-libmvec-acosh.c"

View File

@ -0,0 +1 @@
#include "test-double-libmvec-acosh.c"

View File

@ -0,0 +1 @@
#include "test-double-libmvec-acosh.c"

View File

@ -0,0 +1,3 @@
#define LIBMVEC_TYPE double
#define LIBMVEC_FUNC acosh
#include "test-vector-abi-arg1.h"

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10), _ZGVbN2v_log10)
VECTOR_WRAPPER (WRAPPER_NAME (log2), _ZGVbN2v_log2)
VECTOR_WRAPPER (WRAPPER_NAME (log1p), _ZGVbN2v_log1p)
VECTOR_WRAPPER (WRAPPER_NAME (atanh), _ZGVbN2v_atanh)
VECTOR_WRAPPER (WRAPPER_NAME (acosh), _ZGVbN2v_acosh)
#define VEC_INT_TYPE __m128i

View File

@ -45,6 +45,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10), _ZGVdN4v_log10)
VECTOR_WRAPPER (WRAPPER_NAME (log2), _ZGVdN4v_log2)
VECTOR_WRAPPER (WRAPPER_NAME (log1p), _ZGVdN4v_log1p)
VECTOR_WRAPPER (WRAPPER_NAME (atanh), _ZGVdN4v_atanh)
VECTOR_WRAPPER (WRAPPER_NAME (acosh), _ZGVdN4v_acosh)
#ifndef __ILP32__
# define VEC_INT_TYPE __m256i

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10), _ZGVcN4v_log10)
VECTOR_WRAPPER (WRAPPER_NAME (log2), _ZGVcN4v_log2)
VECTOR_WRAPPER (WRAPPER_NAME (log1p), _ZGVcN4v_log1p)
VECTOR_WRAPPER (WRAPPER_NAME (atanh), _ZGVcN4v_atanh)
VECTOR_WRAPPER (WRAPPER_NAME (acosh), _ZGVcN4v_acosh)
#define VEC_INT_TYPE __m128i

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10), _ZGVeN8v_log10)
VECTOR_WRAPPER (WRAPPER_NAME (log2), _ZGVeN8v_log2)
VECTOR_WRAPPER (WRAPPER_NAME (log1p), _ZGVeN8v_log1p)
VECTOR_WRAPPER (WRAPPER_NAME (atanh), _ZGVeN8v_atanh)
VECTOR_WRAPPER (WRAPPER_NAME (acosh), _ZGVeN8v_acosh)
#ifndef __ILP32__
# define VEC_INT_TYPE __m512i

View File

@ -0,0 +1 @@
#include "test-float-libmvec-acoshf.c"

View File

@ -0,0 +1 @@
#include "test-float-libmvec-acoshf.c"

View File

@ -0,0 +1 @@
#include "test-float-libmvec-acoshf.c"

View File

@ -0,0 +1,3 @@
#define LIBMVEC_TYPE float
#define LIBMVEC_FUNC acoshf
#include "test-vector-abi-arg1.h"

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10f), _ZGVeN16v_log10f)
VECTOR_WRAPPER (WRAPPER_NAME (log2f), _ZGVeN16v_log2f)
VECTOR_WRAPPER (WRAPPER_NAME (log1pf), _ZGVeN16v_log1pf)
VECTOR_WRAPPER (WRAPPER_NAME (atanhf), _ZGVeN16v_atanhf)
VECTOR_WRAPPER (WRAPPER_NAME (acoshf), _ZGVeN16v_acoshf)
#define VEC_INT_TYPE __m512i

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10f), _ZGVbN4v_log10f)
VECTOR_WRAPPER (WRAPPER_NAME (log2f), _ZGVbN4v_log2f)
VECTOR_WRAPPER (WRAPPER_NAME (log1pf), _ZGVbN4v_log1pf)
VECTOR_WRAPPER (WRAPPER_NAME (atanhf), _ZGVbN4v_atanhf)
VECTOR_WRAPPER (WRAPPER_NAME (acoshf), _ZGVbN4v_acoshf)
#define VEC_INT_TYPE __m128i

View File

@ -45,6 +45,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10f), _ZGVdN8v_log10f)
VECTOR_WRAPPER (WRAPPER_NAME (log2f), _ZGVdN8v_log2f)
VECTOR_WRAPPER (WRAPPER_NAME (log1pf), _ZGVdN8v_log1pf)
VECTOR_WRAPPER (WRAPPER_NAME (atanhf), _ZGVdN8v_atanhf)
VECTOR_WRAPPER (WRAPPER_NAME (acoshf), _ZGVdN8v_acoshf)
/* Redefinition of wrapper to be compatible with _ZGVdN8vvv_sincosf. */
#undef VECTOR_WRAPPER_fFF

View File

@ -42,6 +42,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (log10f), _ZGVcN8v_log10f)
VECTOR_WRAPPER (WRAPPER_NAME (log2f), _ZGVcN8v_log2f)
VECTOR_WRAPPER (WRAPPER_NAME (log1pf), _ZGVcN8v_log1pf)
VECTOR_WRAPPER (WRAPPER_NAME (atanhf), _ZGVcN8v_atanhf)
VECTOR_WRAPPER (WRAPPER_NAME (acoshf), _ZGVcN8v_acoshf)
#define VEC_INT_TYPE __m128i