aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSunil K Pandey <skpgkp2@gmail.com>2021-12-29 09:17:28 -0800
committerSunil K Pandey <skpgkp2@gmail.com>2021-12-29 11:38:09 -0800
commit2941a24f8c914403bd14b035f806de9491622453 (patch)
tree91a6863e30155acae88de47bcc8067f19e1f3ee7 /sysdeps
parent2bf02c5843896c5c109b1467c64ecf11cbc2ad7b (diff)
downloadglibc-2941a24f8c914403bd14b035f806de9491622453.zip
glibc-2941a24f8c914403bd14b035f806de9491622453.tar.gz
glibc-2941a24f8c914403bd14b035f806de9491622453.tar.bz2
x86-64: Add vector atan2/atan2f implementation to libmvec
Implement vectorized atan2/atan2f containing SSE, AVX, AVX2 and AVX512 versions for libmvec as per vector ABI. It also contains accuracy and ABI tests for vector atan2/atan2f with regenerated ulps. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/libmvec.abilist8
-rw-r--r--sysdeps/x86/fpu/bits/math-vector.h4
-rw-r--r--sysdeps/x86/fpu/finclude/math-vector-fortran.h4
-rw-r--r--sysdeps/x86_64/fpu/Makeconfig1
-rw-r--r--sysdeps/x86_64/fpu/Versions2
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core-sse2.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core_sse4.S471
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core-sse.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core_avx2.S451
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core-avx2.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core_avx512.S475
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core-avx2.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core_avx512.S399
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core-sse2.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core_sse4.S384
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core-sse.S20
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core.c28
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core_avx2.S362
-rw-r--r--sysdeps/x86_64/fpu/svml_d_atan22_core.S29
-rw-r--r--sysdeps/x86_64/fpu/svml_d_atan24_core.S29
-rw-r--r--sysdeps/x86_64/fpu/svml_d_atan24_core_avx.S25
-rw-r--r--sysdeps/x86_64/fpu/svml_d_atan28_core.S25
-rw-r--r--sysdeps/x86_64/fpu/svml_s_atan2f16_core.S25
-rw-r--r--sysdeps/x86_64/fpu/svml_s_atan2f4_core.S29
-rw-r--r--sysdeps/x86_64/fpu/svml_s_atan2f8_core.S29
-rw-r--r--sysdeps/x86_64/fpu/svml_s_atan2f8_core_avx.S25
-rw-r--r--sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx2.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx512f.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-libmvec-atan2.c3
-rw-r--r--sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx2.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx512f.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-libmvec-atan2f.c3
-rw-r--r--sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c1
-rw-r--r--sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c1
48 files changed, 3105 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
index a6558d9..2b3b8d3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
@@ -55,6 +55,7 @@ GLIBC_2.35 _ZGVbN2v_exp10 F
GLIBC_2.35 _ZGVbN2v_exp2 F
GLIBC_2.35 _ZGVbN2v_expm1 F
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_asinf F
@@ -65,6 +66,7 @@ GLIBC_2.35 _ZGVbN4v_exp10f F
GLIBC_2.35 _ZGVbN4v_exp2f F
GLIBC_2.35 _ZGVbN4v_expm1f F
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_asin F
@@ -75,6 +77,7 @@ GLIBC_2.35 _ZGVcN4v_exp10 F
GLIBC_2.35 _ZGVcN4v_exp2 F
GLIBC_2.35 _ZGVcN4v_expm1 F
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_asinf F
@@ -85,6 +88,7 @@ GLIBC_2.35 _ZGVcN8v_exp10f F
GLIBC_2.35 _ZGVcN8v_exp2f F
GLIBC_2.35 _ZGVcN8v_expm1f F
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_asin F
@@ -95,6 +99,7 @@ GLIBC_2.35 _ZGVdN4v_exp10 F
GLIBC_2.35 _ZGVdN4v_exp2 F
GLIBC_2.35 _ZGVdN4v_expm1 F
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_asinf F
@@ -105,6 +110,7 @@ GLIBC_2.35 _ZGVdN8v_exp10f F
GLIBC_2.35 _ZGVdN8v_exp2f F
GLIBC_2.35 _ZGVdN8v_expm1f F
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_asinf F
@@ -115,6 +121,7 @@ GLIBC_2.35 _ZGVeN16v_exp10f F
GLIBC_2.35 _ZGVeN16v_exp2f F
GLIBC_2.35 _ZGVeN16v_expm1f F
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_asin F
@@ -125,4 +132,5 @@ GLIBC_2.35 _ZGVeN8v_exp10 F
GLIBC_2.35 _ZGVeN8v_exp2 F
GLIBC_2.35 _ZGVeN8v_expm1 F
GLIBC_2.35 _ZGVeN8v_sinh F
+GLIBC_2.35 _ZGVeN8vv_atan2 F
GLIBC_2.35 _ZGVeN8vv_hypot F
diff --git a/sysdeps/x86/fpu/bits/math-vector.h b/sysdeps/x86/fpu/bits/math-vector.h
index dcd4593..62f2890 100644
--- a/sysdeps/x86/fpu/bits/math-vector.h
+++ b/sysdeps/x86/fpu/bits/math-vector.h
@@ -98,6 +98,10 @@
# define __DECL_SIMD_cbrt __DECL_SIMD_x86_64
# undef __DECL_SIMD_cbrtf
# define __DECL_SIMD_cbrtf __DECL_SIMD_x86_64
+# undef __DECL_SIMD_atan2
+# define __DECL_SIMD_atan2 __DECL_SIMD_x86_64
+# undef __DECL_SIMD_atan2f
+# define __DECL_SIMD_atan2f __DECL_SIMD_x86_64
# endif
#endif
diff --git a/sysdeps/x86/fpu/finclude/math-vector-fortran.h b/sysdeps/x86/fpu/finclude/math-vector-fortran.h
index dfb5f13..2269b74 100644
--- a/sysdeps/x86/fpu/finclude/math-vector-fortran.h
+++ b/sysdeps/x86/fpu/finclude/math-vector-fortran.h
@@ -48,6 +48,8 @@
!GCC$ builtin (sinhf) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (cbrt) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (cbrtf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (atan2) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (atan2f) attributes simd (notinbranch) if('x86_64')
!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
@@ -81,3 +83,5 @@
!GCC$ builtin (sinhf) attributes simd (notinbranch) if('x32')
!GCC$ builtin (cbrt) attributes simd (notinbranch) if('x32')
!GCC$ builtin (cbrtf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (atan2) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (atan2f) attributes simd (notinbranch) if('x32')
diff --git a/sysdeps/x86_64/fpu/Makeconfig b/sysdeps/x86_64/fpu/Makeconfig
index dde737c..96a4085 100644
--- a/sysdeps/x86_64/fpu/Makeconfig
+++ b/sysdeps/x86_64/fpu/Makeconfig
@@ -25,6 +25,7 @@ libmvec-funcs = \
acos \
asin \
atan \
+ atan2 \
cbrt \
cos \
cosh \
diff --git a/sysdeps/x86_64/fpu/Versions b/sysdeps/x86_64/fpu/Versions
index b70aeb3..f58c98e 100644
--- a/sysdeps/x86_64/fpu/Versions
+++ b/sysdeps/x86_64/fpu/Versions
@@ -23,6 +23,7 @@ libmvec {
_ZGVbN2v_exp2; _ZGVcN4v_exp2; _ZGVdN4v_exp2; _ZGVeN8v_exp2;
_ZGVbN2v_expm1; _ZGVcN4v_expm1; _ZGVdN4v_expm1; _ZGVeN8v_expm1;
_ZGVbN2v_sinh; _ZGVcN4v_sinh; _ZGVdN4v_sinh; _ZGVeN8v_sinh;
+ _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_asinf; _ZGVcN8v_asinf; _ZGVdN8v_asinf; _ZGVeN16v_asinf;
@@ -33,6 +34,7 @@ libmvec {
_ZGVbN4v_exp2f; _ZGVcN8v_exp2f; _ZGVdN8v_exp2f; _ZGVeN16v_exp2f;
_ZGVbN4v_expm1f; _ZGVcN8v_expm1f; _ZGVdN8v_expm1f; _ZGVeN16v_expm1f;
_ZGVbN4v_sinhf; _ZGVcN8v_sinhf; _ZGVdN8v_sinhf; _ZGVeN16v_sinhf;
+ _ZGVbN4vv_atan2f; _ZGVcN8vv_atan2f; _ZGVdN8vv_atan2f; _ZGVeN16vv_atan2f;
_ZGVbN4vv_hypotf; _ZGVcN8vv_hypotf; _ZGVdN8vv_hypotf; _ZGVeN16vv_hypotf;
}
}
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index e039a99..6f59c61 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -166,6 +166,26 @@ float: 2
float128: 2
ldouble: 1
+Function: "atan2_vlen16":
+float: 2
+
+Function: "atan2_vlen2":
+double: 1
+
+Function: "atan2_vlen4":
+double: 1
+float: 2
+
+Function: "atan2_vlen4_avx2":
+double: 1
+
+Function: "atan2_vlen8":
+double: 1
+float: 2
+
+Function: "atan2_vlen8_avx2":
+float: 2
+
Function: "atan_downward":
double: 1
float: 2
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core-sse2.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core-sse2.S
new file mode 100644
index 0000000..6c3ad05
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core-sse2.S
@@ -0,0 +1,20 @@
+/* SSE2 version of vectorized atan2.
+ 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 _ZGVbN2vv_atan2 _ZGVbN2vv_atan2_sse2
+#include "../svml_d_atan22_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core.c b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core.c
new file mode 100644
index 0000000..43f1ee7
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized atan2, 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 _ZGVbN2vv_atan2
+#include "ifunc-mathvec-sse4_1.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVbN2vv_atan2, __GI__ZGVbN2vv_atan2,
+ __redirect__ZGVbN2vv_atan2)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core_sse4.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core_sse4.S
new file mode 100644
index 0000000..5c0d0fd
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan22_core_sse4.S
@@ -0,0 +1,471 @@
+/* Function atan2 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_datan2_data_internal
+ */
+#define dPI 0
+#define dPIO2 16
+#define dA19 32
+#define dA18 48
+#define dA17 64
+#define dA16 80
+#define dA15 96
+#define dA14 112
+#define dA13 128
+#define dA12 144
+#define dA11 160
+#define dA10 176
+#define dA09 192
+#define dA08 208
+#define dA07 224
+#define dA06 240
+#define dA05 256
+#define dA04 272
+#define dA03 288
+#define dA02 304
+#define dA01 320
+#define dA00 336
+#define dSIGN_MASK 352
+#define iCHK_WORK_SUB 368
+#define iCHK_WORK_CMP 384
+#define dABS_MASK 400
+#define dZERO 416
+
+#include <sysdep.h>
+
+ .text
+ .section .text.sse4,"ax",@progbits
+ENTRY(_ZGVbN2vv_atan2_sse4)
+ subq $88, %rsp
+ cfi_def_cfa_offset(96)
+ movaps %xmm0, %xmm8
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Get r0~=1/B
+ * Cannot be replaced by VQRCP(D, dR0, dB);
+ * Argument Absolute values
+ */
+ movups dABS_MASK+__svml_datan2_data_internal(%rip), %xmm4
+ movaps %xmm1, %xmm9
+ movaps %xmm4, %xmm1
+ andps %xmm8, %xmm4
+ andps %xmm9, %xmm1
+ movaps %xmm4, %xmm2
+ cmpnltpd %xmm1, %xmm2
+
+/* Argument signs */
+ movups dSIGN_MASK+__svml_datan2_data_internal(%rip), %xmm3
+ movaps %xmm2, %xmm0
+ movups dPIO2+__svml_datan2_data_internal(%rip), %xmm5
+ movaps %xmm3, %xmm7
+ movaps %xmm3, %xmm6
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ orps %xmm1, %xmm3
+ movaps %xmm2, %xmm10
+ andps %xmm2, %xmm5
+ andnps %xmm4, %xmm0
+ andps %xmm2, %xmm3
+ andnps %xmm1, %xmm10
+ andps %xmm4, %xmm2
+ orps %xmm3, %xmm0
+ orps %xmm2, %xmm10
+ divpd %xmm10, %xmm0
+ movq iCHK_WORK_SUB+__svml_datan2_data_internal(%rip), %xmm11
+
+/* if x<0, dPI = Pi, else dPI =0 */
+ movaps %xmm9, %xmm3
+
+/* Check if y and x are on main path. */
+ pshufd $221, %xmm1, %xmm12
+ andps %xmm9, %xmm7
+ psubd %xmm11, %xmm12
+ andps %xmm8, %xmm6
+ movq iCHK_WORK_CMP+__svml_datan2_data_internal(%rip), %xmm13
+ xorl %edx, %edx
+ movups %xmm4, 16(%rsp)
+ xorl %eax, %eax
+ pshufd $221, %xmm4, %xmm14
+ movdqa %xmm12, %xmm4
+ pcmpgtd %xmm13, %xmm4
+ pcmpeqd %xmm13, %xmm12
+ por %xmm12, %xmm4
+
+/* Polynomial. */
+ movaps %xmm0, %xmm12
+ mulpd %xmm0, %xmm12
+ cmplepd dZERO+__svml_datan2_data_internal(%rip), %xmm3
+ psubd %xmm11, %xmm14
+ movdqa %xmm14, %xmm15
+ pcmpeqd %xmm13, %xmm14
+ pcmpgtd %xmm13, %xmm15
+ por %xmm14, %xmm15
+ movaps %xmm12, %xmm14
+ mulpd %xmm12, %xmm14
+ por %xmm15, %xmm4
+ movaps %xmm14, %xmm15
+ mulpd %xmm14, %xmm15
+ movmskps %xmm4, %ecx
+ movups %xmm10, (%rsp)
+ movups dA19+__svml_datan2_data_internal(%rip), %xmm10
+ mulpd %xmm15, %xmm10
+ movups dA18+__svml_datan2_data_internal(%rip), %xmm13
+ movups dA17+__svml_datan2_data_internal(%rip), %xmm11
+ addpd dA15+__svml_datan2_data_internal(%rip), %xmm10
+ mulpd %xmm15, %xmm13
+ mulpd %xmm15, %xmm11
+ mulpd %xmm15, %xmm10
+ addpd dA14+__svml_datan2_data_internal(%rip), %xmm13
+ addpd dA13+__svml_datan2_data_internal(%rip), %xmm11
+ addpd dA11+__svml_datan2_data_internal(%rip), %xmm10
+ mulpd %xmm15, %xmm13
+ mulpd %xmm15, %xmm11
+ mulpd %xmm15, %xmm10
+ addpd dA10+__svml_datan2_data_internal(%rip), %xmm13
+ addpd dA09+__svml_datan2_data_internal(%rip), %xmm11
+ addpd dA07+__svml_datan2_data_internal(%rip), %xmm10
+ mulpd %xmm15, %xmm13
+ mulpd %xmm15, %xmm11
+ mulpd %xmm15, %xmm10
+ addpd dA06+__svml_datan2_data_internal(%rip), %xmm13
+ addpd dA05+__svml_datan2_data_internal(%rip), %xmm11
+ addpd dA03+__svml_datan2_data_internal(%rip), %xmm10
+ mulpd %xmm15, %xmm13
+ mulpd %xmm15, %xmm11
+ mulpd %xmm12, %xmm10
+ addpd dA02+__svml_datan2_data_internal(%rip), %xmm13
+ addpd dA01+__svml_datan2_data_internal(%rip), %xmm11
+ addpd %xmm10, %xmm13
+ mulpd %xmm11, %xmm12
+ mulpd %xmm13, %xmm14
+ movups dA16+__svml_datan2_data_internal(%rip), %xmm2
+ mulpd %xmm15, %xmm2
+ addpd dA12+__svml_datan2_data_internal(%rip), %xmm2
+ mulpd %xmm15, %xmm2
+ addpd dA08+__svml_datan2_data_internal(%rip), %xmm2
+ mulpd %xmm15, %xmm2
+ addpd dA04+__svml_datan2_data_internal(%rip), %xmm2
+
+/* A00=1.0, account for it later VQFMA(D, dP4, dP4, dR8, dA00); */
+ mulpd %xmm2, %xmm15
+ addpd %xmm12, %xmm15
+ addpd %xmm14, %xmm15
+
+/*
+ * Reconstruction.
+ * dP=(R+R*dP) + dPIO2
+ */
+ mulpd %xmm0, %xmm15
+ addpd %xmm15, %xmm0
+ addpd %xmm5, %xmm0
+ andps __svml_datan2_data_internal(%rip), %xmm3
+ orps %xmm7, %xmm0
+ addpd %xmm3, %xmm0
+
+/* Special branch for fast (vector) processing of zero arguments */
+ movups 16(%rsp), %xmm11
+ orps %xmm6, %xmm0
+ testb $3, %cl
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm1 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm11
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm8 xmm9
+
+/* Restore registers
+ * and exit the function
+ */
+
+L(EXIT):
+ addq $88, %rsp
+ cfi_def_cfa_offset(8)
+ ret
+ cfi_def_cfa_offset(96)
+
+/* Branch to process
+ * special inputs
+ */
+
+L(SPECIAL_VALUES_BRANCH):
+ movups %xmm8, 32(%rsp)
+ movups %xmm9, 48(%rsp)
+ movups %xmm0, 64(%rsp)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0
+
+ movq %r12, 16(%rsp)
+ cfi_offset(12, -80)
+ movl %eax, %r12d
+ movq %r13, 8(%rsp)
+ cfi_offset(13, -88)
+ movl %edx, %r13d
+ movq %r14, (%rsp)
+ cfi_offset(14, -96)
+ # 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 $2, %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 64(%rsp), %xmm0
+
+/* Go to exit */
+ jmp L(EXIT)
+ cfi_offset(12, -80)
+ cfi_offset(13, -88)
+ cfi_offset(14, -96)
+ # LOE rbx rbp r12 r13 r14 r15 xmm0
+
+/* Scalar math fucntion call
+ * to process special input
+ */
+
+L(SCALAR_MATH_CALL):
+ movl %r12d, %r14d
+ movsd 32(%rsp,%r14,8), %xmm0
+ movsd 48(%rsp,%r14,8), %xmm1
+ call atan2@PLT
+ # LOE rbx rbp r14 r15 r12d r13d xmm0
+
+ movsd %xmm0, 64(%rsp,%r14,8)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx rbp r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ movups dZERO+__svml_datan2_data_internal(%rip), %xmm2
+
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ movaps %xmm9, %xmm12
+ movaps %xmm8, %xmm10
+ cmpordpd %xmm9, %xmm12
+ cmpordpd %xmm8, %xmm10
+ cmpeqpd %xmm2, %xmm1
+ cmpeqpd %xmm2, %xmm11
+ andps %xmm10, %xmm12
+ orps %xmm11, %xmm1
+ pshufd $221, %xmm1, %xmm1
+ pshufd $221, %xmm12, %xmm11
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ pand %xmm11, %xmm1
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ movdqa %xmm1, %xmm13
+ pandn %xmm4, %xmm13
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ movups (%rsp), %xmm4
+ cmpeqpd %xmm2, %xmm4
+
+/* Go to callout */
+ movmskps %xmm13, %edx
+
+/* Set sPIO2 to zero if den. is zero */
+ movaps %xmm4, %xmm15
+ andps %xmm2, %xmm4
+ andnps %xmm5, %xmm15
+ andl $3, %edx
+ orps %xmm4, %xmm15
+ pshufd $221, %xmm9, %xmm5
+ orps %xmm7, %xmm15
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ pshufd $221, %xmm2, %xmm7
+ pcmpgtd %xmm5, %xmm7
+ pshufd $80, %xmm7, %xmm14
+ andps %xmm3, %xmm14
+ addpd %xmm14, %xmm15
+
+/* Merge results from main and spec path */
+ pshufd $80, %xmm1, %xmm3
+ orps %xmm6, %xmm15
+ movdqa %xmm3, %xmm6
+ andps %xmm3, %xmm15
+ andnps %xmm0, %xmm6
+ movaps %xmm6, %xmm0
+ orps %xmm15, %xmm0
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm8 xmm9
+END(_ZGVbN2vv_atan2_sse4)
+
+ .section .rodata, "a"
+ .align 16
+
+#ifdef __svml_datan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(16)) VUINT32 dPI[2][2];
+ __declspec(align(16)) VUINT32 dPIO2[2][2];
+ __declspec(align(16)) VUINT32 dA19[2][2];
+ __declspec(align(16)) VUINT32 dA18[2][2];
+ __declspec(align(16)) VUINT32 dA17[2][2];
+ __declspec(align(16)) VUINT32 dA16[2][2];
+ __declspec(align(16)) VUINT32 dA15[2][2];
+ __declspec(align(16)) VUINT32 dA14[2][2];
+ __declspec(align(16)) VUINT32 dA13[2][2];
+ __declspec(align(16)) VUINT32 dA12[2][2];
+ __declspec(align(16)) VUINT32 dA11[2][2];
+ __declspec(align(16)) VUINT32 dA10[2][2];
+ __declspec(align(16)) VUINT32 dA09[2][2];
+ __declspec(align(16)) VUINT32 dA08[2][2];
+ __declspec(align(16)) VUINT32 dA07[2][2];
+ __declspec(align(16)) VUINT32 dA06[2][2];
+ __declspec(align(16)) VUINT32 dA05[2][2];
+ __declspec(align(16)) VUINT32 dA04[2][2];
+ __declspec(align(16)) VUINT32 dA03[2][2];
+ __declspec(align(16)) VUINT32 dA02[2][2];
+ __declspec(align(16)) VUINT32 dA01[2][2];
+ __declspec(align(16)) VUINT32 dA00[2][2];
+ __declspec(align(16)) VUINT32 dSIGN_MASK[2][2];
+ __declspec(align(16)) VUINT32 iCHK_WORK_SUB[4][1];
+ __declspec(align(16)) VUINT32 iCHK_WORK_CMP[4][1];
+ __declspec(align(16)) VUINT32 dABS_MASK[2][2];
+ __declspec(align(16)) VUINT32 dZERO[2][2];
+} __svml_datan2_data_internal;
+#endif
+__svml_datan2_data_internal:
+ .quad 0x400921FB54442D18, 0x400921FB54442D18 //dPI
+ .align 16
+ .quad 0x3FF921FB54442D18, 0x3FF921FB54442D18 //dPIO2
+ .align 16
+ .quad 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3 // dA19
+ .align 16
+ .quad 0x3F2CED0A36665209, 0x3F2CED0A36665209 // dA18
+ .align 16
+ .quad 0xBF52E67C93954C23, 0xBF52E67C93954C23 // dA17
+ .align 16
+ .quad 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3 // dA16
+ .align 16
+ .quad 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD // dA15
+ .align 16
+ .quad 0x3F914F4C661116A5, 0x3F914F4C661116A5 // dA14
+ .align 16
+ .quad 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C // dA13
+ .align 16
+ .quad 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F // dA12
+ .align 16
+ .quad 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC // dA11
+ .align 16
+ .quad 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B // dA10
+ .align 16
+ .quad 0xBFAAD261EAA09954, 0xBFAAD261EAA09954 // dA09
+ .align 16
+ .quad 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF // dA08
+ .align 16
+ .quad 0xBFB11084009435E0, 0xBFB11084009435E0 // dA07
+ .align 16
+ .quad 0x3FB3B12A49295651, 0x3FB3B12A49295651 // dA06
+ .align 16
+ .quad 0xBFB745D009BADA94, 0xBFB745D009BADA94 // dA05
+ .align 16
+ .quad 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5 // dA04
+ .align 16
+ .quad 0xBFC2492491EE55C7, 0xBFC2492491EE55C7 // dA03
+ .align 16
+ .quad 0x3FC999999997EE34, 0x3FC999999997EE34 // dA02
+ .align 16
+ .quad 0xBFD55555555553C5, 0xBFD55555555553C5 // dA01
+ .align 16
+ .quad 0x3FF0000000000000, 0x3FF0000000000000 // dA00
+ .align 16
+ .quad 0x8000000000000000, 0x8000000000000000 //dSIGN_MASK
+ .align 16
+ .long 0x80300000, 0x80300000, 0x80300000, 0x80300000 //iCHK_WORK_SUB
+ .align 16
+ .long 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000 //iCHK_WORK_CMP
+ .align 16
+ .quad 0x7fffffffffffffff, 0x7fffffffffffffff //dABS_MASK
+ .align 16
+ .quad 0x0000000000000000, 0x0000000000000000 //dZERO
+ .align 16
+ .type __svml_datan2_data_internal,@object
+ .size __svml_datan2_data_internal,.-__svml_datan2_data_internal
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core-sse.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core-sse.S
new file mode 100644
index 0000000..0db843a
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core-sse.S
@@ -0,0 +1,20 @@
+/* SSE version of vectorized atan2.
+ 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 _ZGVdN4vv_atan2 _ZGVdN4vv_atan2_sse_wrapper
+#include "../svml_d_atan24_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core.c b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core.c
new file mode 100644
index 0000000..c2e2611
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized atan2, 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 _ZGVdN4vv_atan2
+#include "ifunc-mathvec-avx2.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVdN4vv_atan2, __GI__ZGVdN4vv_atan2,
+ __redirect__ZGVdN4vv_atan2)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core_avx2.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core_avx2.S
new file mode 100644
index 0000000..cdf7807
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan24_core_avx2.S
@@ -0,0 +1,451 @@
+/* Function atan2 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_datan2_data_internal
+ */
+#define dPI 0
+#define dPIO2 32
+#define dA19 64
+#define dA18 96
+#define dA17 128
+#define dA16 160
+#define dA15 192
+#define dA14 224
+#define dA13 256
+#define dA12 288
+#define dA11 320
+#define dA10 352
+#define dA09 384
+#define dA08 416
+#define dA07 448
+#define dA06 480
+#define dA05 512
+#define dA04 544
+#define dA03 576
+#define dA02 608
+#define dA01 640
+#define dA00 672
+#define dSIGN_MASK 704
+#define iCHK_WORK_SUB 736
+#define iCHK_WORK_CMP 768
+#define dABS_MASK 800
+#define dZERO 832
+
+#include <sysdep.h>
+
+ .text
+ .section .text.avx2,"ax",@progbits
+ENTRY(_ZGVdN4vv_atan2_avx2)
+ pushq %rbp
+ cfi_def_cfa_offset(16)
+ movq %rsp, %rbp
+ cfi_def_cfa(6, 16)
+ cfi_offset(6, -16)
+ andq $-32, %rsp
+ subq $128, %rsp
+ xorl %edx, %edx
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Get r0~=1/B
+ * Cannot be replaced by VQRCP(D, dR0, dB);
+ * Argument Absolute values
+ */
+ vmovupd dABS_MASK+__svml_datan2_data_internal(%rip), %ymm5
+
+/* Argument signs */
+ vmovupd dSIGN_MASK+__svml_datan2_data_internal(%rip), %ymm4
+ vmovups iCHK_WORK_SUB+__svml_datan2_data_internal(%rip), %xmm13
+ vmovupd %ymm0, (%rsp)
+ vmovapd %ymm1, %ymm8
+ vandpd %ymm5, %ymm8, %ymm2
+ vandpd %ymm5, %ymm0, %ymm1
+ vcmpnlt_uqpd %ymm2, %ymm1, %ymm15
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ vorpd %ymm4, %ymm2, %ymm6
+ vblendvpd %ymm15, %ymm6, %ymm1, %ymm3
+ vblendvpd %ymm15, %ymm1, %ymm2, %ymm6
+ vdivpd %ymm6, %ymm3, %ymm14
+ vmovups iCHK_WORK_CMP+__svml_datan2_data_internal(%rip), %xmm3
+ vmovupd %ymm6, 32(%rsp)
+ vandpd %ymm4, %ymm0, %ymm7
+ vandpd %ymm4, %ymm8, %ymm5
+ vandpd dPIO2+__svml_datan2_data_internal(%rip), %ymm15, %ymm4
+
+/* Check if y and x are on main path. */
+ vextractf128 $1, %ymm2, %xmm9
+ vextractf128 $1, %ymm1, %xmm10
+ vshufps $221, %xmm9, %xmm2, %xmm11
+ vshufps $221, %xmm10, %xmm1, %xmm12
+ vpsubd %xmm13, %xmm11, %xmm0
+ vpsubd %xmm13, %xmm12, %xmm9
+ vpcmpgtd %xmm3, %xmm0, %xmm15
+ vpcmpeqd %xmm3, %xmm0, %xmm6
+ vpcmpgtd %xmm3, %xmm9, %xmm10
+ vpcmpeqd %xmm3, %xmm9, %xmm3
+ vpor %xmm6, %xmm15, %xmm11
+ vpor %xmm3, %xmm10, %xmm12
+
+/* Polynomial. */
+ vmulpd %ymm14, %ymm14, %ymm10
+ vpor %xmm12, %xmm11, %xmm3
+ vmovupd dA18+__svml_datan2_data_internal(%rip), %ymm9
+ vmovupd dA17+__svml_datan2_data_internal(%rip), %ymm12
+ vmovupd dA16+__svml_datan2_data_internal(%rip), %ymm15
+ vmulpd %ymm10, %ymm10, %ymm11
+
+/* if x<0, dPI = Pi, else dPI =0 */
+ vcmple_oqpd dZERO+__svml_datan2_data_internal(%rip), %ymm8, %ymm13
+ vmovmskps %xmm3, %eax
+ vmulpd %ymm11, %ymm11, %ymm0
+ vandpd __svml_datan2_data_internal(%rip), %ymm13, %ymm6
+ vmovupd dA19+__svml_datan2_data_internal(%rip), %ymm13
+ vfmadd213pd dA14+__svml_datan2_data_internal(%rip), %ymm0, %ymm9
+ vfmadd213pd dA13+__svml_datan2_data_internal(%rip), %ymm0, %ymm12
+ vfmadd213pd dA12+__svml_datan2_data_internal(%rip), %ymm0, %ymm15
+ vfmadd213pd dA15+__svml_datan2_data_internal(%rip), %ymm0, %ymm13
+ vfmadd213pd dA10+__svml_datan2_data_internal(%rip), %ymm0, %ymm9
+ vfmadd213pd dA09+__svml_datan2_data_internal(%rip), %ymm0, %ymm12
+ vfmadd213pd dA08+__svml_datan2_data_internal(%rip), %ymm0, %ymm15
+ vfmadd213pd dA11+__svml_datan2_data_internal(%rip), %ymm0, %ymm13
+ vfmadd213pd dA06+__svml_datan2_data_internal(%rip), %ymm0, %ymm9
+ vfmadd213pd dA05+__svml_datan2_data_internal(%rip), %ymm0, %ymm12
+ vfmadd213pd dA04+__svml_datan2_data_internal(%rip), %ymm0, %ymm15
+ vfmadd213pd dA07+__svml_datan2_data_internal(%rip), %ymm0, %ymm13
+ vfmadd213pd dA02+__svml_datan2_data_internal(%rip), %ymm0, %ymm9
+ vfmadd213pd dA01+__svml_datan2_data_internal(%rip), %ymm0, %ymm12
+ vfmadd213pd dA03+__svml_datan2_data_internal(%rip), %ymm0, %ymm13
+
+/* A00=1.0, account for it later VQFMA(D, dP4, dP4, dR8, dA00); */
+ vmulpd %ymm15, %ymm0, %ymm0
+ vfmadd213pd %ymm9, %ymm10, %ymm13
+ vfmadd213pd %ymm0, %ymm10, %ymm12
+ vfmadd213pd %ymm12, %ymm11, %ymm13
+
+/*
+ * Reconstruction.
+ * dP=(R+R*dP) + dPIO2
+ */
+ vfmadd213pd %ymm14, %ymm14, %ymm13
+ vaddpd %ymm13, %ymm4, %ymm14
+ vorpd %ymm5, %ymm14, %ymm0
+ vaddpd %ymm0, %ymm6, %ymm9
+ vorpd %ymm7, %ymm9, %ymm0
+
+/* Special branch for fast (vector) processing of zero arguments */
+ testl %eax, %eax
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx xmm3 ymm0 ymm1 ymm2 ymm4 ymm5 ymm6 ymm7 ymm8
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx ymm0 ymm8
+
+/* 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):
+ vmovupd (%rsp), %ymm1
+ vmovupd %ymm8, 64(%rsp)
+ vmovupd %ymm0, 96(%rsp)
+ vmovupd %ymm1, 32(%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: -112; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x90, 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: -120; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x88, 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: -128; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x80, 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 $4, %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)
+ vmovupd 96(%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: -112; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x90, 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: -120; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x88, 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: -128; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x80, 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
+ movsd 32(%rsp,%r14,8), %xmm0
+ movsd 64(%rsp,%r14,8), %xmm1
+ call atan2@PLT
+ # LOE rbx r14 r15 r12d r13d xmm0
+
+ movsd %xmm0, 96(%rsp,%r14,8)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+ vmovupd (%rsp), %ymm11
+
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ vmovupd dZERO+__svml_datan2_data_internal(%rip), %ymm10
+
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ vcmpordpd %ymm8, %ymm8, %ymm12
+ vcmpordpd %ymm11, %ymm11, %ymm13
+ vcmpeqpd %ymm10, %ymm2, %ymm2
+ vcmpeqpd %ymm10, %ymm1, %ymm1
+ vandpd %ymm13, %ymm12, %ymm14
+ vorpd %ymm1, %ymm2, %ymm2
+ vextractf128 $1, %ymm14, %xmm15
+ vextractf128 $1, %ymm2, %xmm11
+ vshufps $221, %xmm15, %xmm14, %xmm9
+ vshufps $221, %xmm11, %xmm2, %xmm12
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ vcmpeqpd 32(%rsp), %ymm10, %ymm2
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ vpand %xmm9, %xmm12, %xmm1
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ vpandn %xmm3, %xmm1, %xmm3
+
+/* Go to callout */
+ vmovmskps %xmm3, %edx
+
+/* Set sPIO2 to zero if den. is zero */
+ vblendvpd %ymm2, %ymm10, %ymm4, %ymm4
+ vorpd %ymm5, %ymm4, %ymm5
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ vextractf128 $1, %ymm10, %xmm2
+ vextractf128 $1, %ymm8, %xmm3
+ vshufps $221, %xmm2, %xmm10, %xmm4
+ vshufps $221, %xmm3, %xmm8, %xmm9
+ vpcmpgtd %xmm9, %xmm4, %xmm12
+ vpshufd $80, %xmm12, %xmm11
+ vpshufd $250, %xmm12, %xmm13
+ vinsertf128 $1, %xmm13, %ymm11, %ymm14
+ vandpd %ymm6, %ymm14, %ymm6
+ vaddpd %ymm6, %ymm5, %ymm2
+ vorpd %ymm7, %ymm2, %ymm2
+
+/* Merge results from main and spec path */
+ vpshufd $80, %xmm1, %xmm7
+ vpshufd $250, %xmm1, %xmm1
+ vinsertf128 $1, %xmm1, %ymm7, %ymm3
+ vblendvpd %ymm3, %ymm2, %ymm0, %ymm0
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx r12 r13 r14 r15 edx ymm0 ymm8
+END(_ZGVdN4vv_atan2_avx2)
+
+ .section .rodata, "a"
+ .align 32
+
+#ifdef __svml_datan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(32)) VUINT32 dPI[4][2];
+ __declspec(align(32)) VUINT32 dPIO2[4][2];
+ __declspec(align(32)) VUINT32 dA19[4][2];
+ __declspec(align(32)) VUINT32 dA18[4][2];
+ __declspec(align(32)) VUINT32 dA17[4][2];
+ __declspec(align(32)) VUINT32 dA16[4][2];
+ __declspec(align(32)) VUINT32 dA15[4][2];
+ __declspec(align(32)) VUINT32 dA14[4][2];
+ __declspec(align(32)) VUINT32 dA13[4][2];
+ __declspec(align(32)) VUINT32 dA12[4][2];
+ __declspec(align(32)) VUINT32 dA11[4][2];
+ __declspec(align(32)) VUINT32 dA10[4][2];
+ __declspec(align(32)) VUINT32 dA09[4][2];
+ __declspec(align(32)) VUINT32 dA08[4][2];
+ __declspec(align(32)) VUINT32 dA07[4][2];
+ __declspec(align(32)) VUINT32 dA06[4][2];
+ __declspec(align(32)) VUINT32 dA05[4][2];
+ __declspec(align(32)) VUINT32 dA04[4][2];
+ __declspec(align(32)) VUINT32 dA03[4][2];
+ __declspec(align(32)) VUINT32 dA02[4][2];
+ __declspec(align(32)) VUINT32 dA01[4][2];
+ __declspec(align(32)) VUINT32 dA00[4][2];
+ __declspec(align(32)) VUINT32 dSIGN_MASK[4][2];
+ __declspec(align(32)) VUINT32 iCHK_WORK_SUB[8][1];
+ __declspec(align(32)) VUINT32 iCHK_WORK_CMP[8][1];
+ __declspec(align(32)) VUINT32 dABS_MASK[4][2];
+ __declspec(align(32)) VUINT32 dZERO[4][2];
+} __svml_datan2_data_internal;
+#endif
+__svml_datan2_data_internal:
+ .quad 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18 //dPI
+ .align 32
+ .quad 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18 //dPIO2
+ .align 32
+ .quad 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3 // dA19
+ .align 32
+ .quad 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209 // dA18
+ .align 32
+ .quad 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23 // dA17
+ .align 32
+ .quad 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3 // dA16
+ .align 32
+ .quad 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD // dA15
+ .align 32
+ .quad 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5 // dA14
+ .align 32
+ .quad 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C // dA13
+ .align 32
+ .quad 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F // dA12
+ .align 32
+ .quad 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC // dA11
+ .align 32
+ .quad 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B // dA10
+ .align 32
+ .quad 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954 // dA09
+ .align 32
+ .quad 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF // dA08
+ .align 32
+ .quad 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0 // dA07
+ .align 32
+ .quad 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651 // dA06
+ .align 32
+ .quad 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94 // dA05
+ .align 32
+ .quad 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5 // dA04
+ .align 32
+ .quad 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7 // dA03
+ .align 32
+ .quad 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34 // dA02
+ .align 32
+ .quad 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5 // dA01
+ .align 32
+ .quad 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000 // dA00
+ .align 32
+ .quad 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000 //dSIGN_MASK
+ .align 32
+ .long 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000 //iCHK_WORK_SUB
+ .align 32
+ .long 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000 //iCHK_WORK_CMP
+ .align 32
+ .quad 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff //dABS_MASK
+ .align 32
+ .quad 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 //dZERO
+ .align 32
+ .type __svml_datan2_data_internal,@object
+ .size __svml_datan2_data_internal,.-__svml_datan2_data_internal
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core-avx2.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core-avx2.S
new file mode 100644
index 0000000..a8d34a6
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core-avx2.S
@@ -0,0 +1,20 @@
+/* AVX2 version of vectorized atan2.
+ 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 _ZGVeN8vv_atan2 _ZGVeN8vv_atan2_avx2_wrapper
+#include "../svml_d_atan28_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core.c b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core.c
new file mode 100644
index 0000000..a0897e9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized atan2, 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 _ZGVeN8vv_atan2
+#include "ifunc-mathvec-avx512-skx.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVeN8vv_atan2, __GI__ZGVeN8vv_atan2,
+ __redirect__ZGVeN8vv_atan2)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core_avx512.S
new file mode 100644
index 0000000..6d18f5f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_atan28_core_avx512.S
@@ -0,0 +1,475 @@
+/* Function atan2 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_datan2_data_internal
+ */
+#define dPI 0
+#define dPIO2 64
+#define dA19 128
+#define dA18 192
+#define dA17 256
+#define dA16 320
+#define dA15 384
+#define dA14 448
+#define dA13 512
+#define dA12 576
+#define dA11 640
+#define dA10 704
+#define dA09 768
+#define dA08 832
+#define dA07 896
+#define dA06 960
+#define dA05 1024
+#define dA04 1088
+#define dA03 1152
+#define dA02 1216
+#define dA01 1280
+#define dA00 1344
+#define dSIGN_MASK 1408
+#define iCHK_WORK_SUB 1472
+#define iCHK_WORK_CMP 1536
+#define dABS_MASK 1600
+#define dZERO 1664
+
+#include <sysdep.h>
+
+ .text
+ .section .text.evex512,"ax",@progbits
+ENTRY(_ZGVeN8vv_atan2_skx)
+ pushq %rbp
+ cfi_def_cfa_offset(16)
+ movq %rsp, %rbp
+ cfi_def_cfa(6, 16)
+ cfi_offset(6, -16)
+ andq $-64, %rsp
+ subq $256, %rsp
+ xorl %edx, %edx
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Get r0~=1/B
+ * Cannot be replaced by VQRCP(D, dR0, dB);
+ * Argument Absolute values
+ */
+ vmovups dABS_MASK+__svml_datan2_data_internal(%rip), %zmm4
+
+/* Argument signs */
+ vmovups dSIGN_MASK+__svml_datan2_data_internal(%rip), %zmm6
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ vmovups dPIO2+__svml_datan2_data_internal(%rip), %zmm3
+ vandpd %zmm4, %zmm0, %zmm11
+ vmovaps %zmm1, %zmm7
+ vandpd %zmm4, %zmm7, %zmm2
+ vandpd %zmm6, %zmm7, %zmm5
+ vandpd %zmm6, %zmm0, %zmm4
+ vorpd %zmm6, %zmm2, %zmm12
+ vcmppd $17, {sae}, %zmm2, %zmm11, %k1
+ vmovdqu iCHK_WORK_CMP+__svml_datan2_data_internal(%rip), %ymm6
+ vmovups %zmm11, 64(%rsp)
+
+/* Check if y and x are on main path. */
+ vpsrlq $32, %zmm2, %zmm9
+ vblendmpd %zmm11, %zmm12, %zmm13{%k1}
+ vblendmpd %zmm2, %zmm11, %zmm15{%k1}
+ vpsrlq $32, %zmm11, %zmm8
+ vmovdqu iCHK_WORK_SUB+__svml_datan2_data_internal(%rip), %ymm12
+ vdivpd {rn-sae}, %zmm15, %zmm13, %zmm1
+ vmovups %zmm15, (%rsp)
+ vpmovqd %zmm9, %ymm14
+ vpmovqd %zmm8, %ymm10
+ vxorpd %zmm3, %zmm3, %zmm3{%k1}
+ vpsubd %ymm12, %ymm14, %ymm13
+ vpsubd %ymm12, %ymm10, %ymm9
+
+/* Polynomial. */
+ vmulpd {rn-sae}, %zmm1, %zmm1, %zmm12
+ vpcmpgtd %ymm6, %ymm13, %ymm15
+ vpcmpeqd %ymm6, %ymm13, %ymm11
+ vmulpd {rn-sae}, %zmm12, %zmm12, %zmm13
+ vpor %ymm11, %ymm15, %ymm8
+ vmovups dA19+__svml_datan2_data_internal(%rip), %zmm11
+ vmovups dA15+__svml_datan2_data_internal(%rip), %zmm15
+ vpcmpgtd %ymm6, %ymm9, %ymm14
+ vpcmpeqd %ymm6, %ymm9, %ymm6
+ vpor %ymm6, %ymm14, %ymm10
+ vmulpd {rn-sae}, %zmm13, %zmm13, %zmm14
+ vmovups dA18+__svml_datan2_data_internal(%rip), %zmm9
+ vpor %ymm10, %ymm8, %ymm6
+ vmovups dA17+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd231pd {rn-sae}, %zmm14, %zmm11, %zmm15
+ vmovups dA14+__svml_datan2_data_internal(%rip), %zmm11
+ vmovups dA12+__svml_datan2_data_internal(%rip), %zmm8
+ vfmadd231pd {rn-sae}, %zmm14, %zmm9, %zmm11
+ vmovups dA13+__svml_datan2_data_internal(%rip), %zmm9
+ vfmadd231pd {rn-sae}, %zmm14, %zmm10, %zmm9
+ vmovups dA16+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd231pd {rn-sae}, %zmm14, %zmm10, %zmm8
+ vmovups dA11+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm15
+ vmovups dA10+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm11
+ vmovups dA09+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm9
+ vmovups dA08+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm8
+ vmovups dA07+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm15
+ vmovups dA06+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm11
+ vmovups dA05+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm9
+ vmovups dA04+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm8
+ vmovups dA03+__svml_datan2_data_internal(%rip), %zmm10
+
+/* A00=1.0, account for it later VQFMA(D, dP4, dP4, dR8, dA00); */
+ vmulpd {rn-sae}, %zmm14, %zmm8, %zmm8
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm15
+ vmovups dA02+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm11
+ vmovups dA01+__svml_datan2_data_internal(%rip), %zmm10
+ vfmadd213pd {rn-sae}, %zmm11, %zmm12, %zmm15
+ vfmadd213pd {rn-sae}, %zmm10, %zmm14, %zmm9
+ vfmadd213pd {rn-sae}, %zmm8, %zmm12, %zmm9
+ vmovups __svml_datan2_data_internal(%rip), %zmm8
+ vfmadd213pd {rn-sae}, %zmm9, %zmm13, %zmm15
+
+/*
+ * Reconstruction.
+ * dP=(R+R*dP) + dPIO2
+ */
+ vfmadd213pd {rn-sae}, %zmm1, %zmm1, %zmm15
+ vaddpd {rn-sae}, %zmm3, %zmm15, %zmm1
+ vorpd %zmm5, %zmm1, %zmm9
+
+/* if x<0, dPI = Pi, else dPI =0 */
+ vmovups dZERO+__svml_datan2_data_internal(%rip), %zmm1
+ vcmppd $18, {sae}, %zmm1, %zmm7, %k2
+ vaddpd {rn-sae}, %zmm8, %zmm9, %zmm9{%k2}
+ vmovmskps %ymm6, %eax
+ vorpd %zmm4, %zmm9, %zmm11
+
+/* Special branch for fast (vector) processing of zero arguments */
+ vmovups 64(%rsp), %zmm9
+ testl %eax, %eax
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx ymm6 zmm0 zmm2 zmm3 zmm4 zmm5 zmm7 zmm9 zmm11
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx zmm0 zmm7 zmm11
+
+/* Restore registers
+ * and exit the function
+ */
+
+L(EXIT):
+ vmovaps %zmm11, %zmm0
+ 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 %zmm0, 64(%rsp)
+ vmovups %zmm7, 128(%rsp)
+ vmovups %zmm11, 192(%rsp)
+ # LOE rbx r12 r13 r14 r15 edx zmm11
+
+ 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: -64; DW_OP_and; DW_OP_const4s: -240; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x10, 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: -248; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x08, 0xff, 0xff, 0xff, 0x22
+ movl %edx, %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: -256; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x00, 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 192(%rsp), %zmm11
+
+/* 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: -240; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x10, 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: -248; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x08, 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: -256; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x00, 0xff, 0xff, 0xff, 0x22
+ # LOE rbx r12 r13 r14 r15 zmm11
+
+/* Scalar math fucntion call
+ * to process special input
+ */
+
+L(SCALAR_MATH_CALL):
+ movl %r12d, %r14d
+ movsd 64(%rsp,%r14,8), %xmm0
+ movsd 128(%rsp,%r14,8), %xmm1
+ call atan2@PLT
+ # LOE rbx r14 r15 r12d r13d xmm0
+
+ movsd %xmm0, 192(%rsp,%r14,8)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ vmovups dZERO+__svml_datan2_data_internal(%rip), %zmm8
+
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ vcmppd $3, {sae}, %zmm7, %zmm7, %k1
+ vcmppd $3, {sae}, %zmm0, %zmm0, %k2
+ vcmppd $4, {sae}, %zmm8, %zmm2, %k3
+ vcmppd $4, {sae}, %zmm8, %zmm9, %k4
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ vpcmpgtq %zmm7, %zmm8, %k6
+ vpternlogd $0xff, %zmm1, %zmm1, %zmm10
+ vmovaps %zmm10, %zmm15
+ vmovaps %zmm10, %zmm12
+ vmovaps %zmm10, %zmm13
+ vpandnq %zmm2, %zmm2, %zmm15{%k3}
+ vmovaps %zmm10, %zmm2
+ vpandnq %zmm7, %zmm7, %zmm12{%k1}
+ vpandnq %zmm0, %zmm0, %zmm13{%k2}
+ vpandnq %zmm9, %zmm9, %zmm2{%k4}
+ vandpd %zmm13, %zmm12, %zmm14
+ vorpd %zmm2, %zmm15, %zmm9
+ vpsrlq $32, %zmm14, %zmm1
+ vpsrlq $32, %zmm9, %zmm2
+ vpmovqd %zmm1, %ymm1
+ vpmovqd %zmm2, %ymm9
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ vpand %ymm1, %ymm9, %ymm2
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ vmovups (%rsp), %zmm1
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ vpandn %ymm6, %ymm2, %ymm6
+ vcmppd $4, {sae}, %zmm8, %zmm1, %k5
+
+/* Go to callout */
+ vmovmskps %ymm6, %edx
+ vpandnq %zmm1, %zmm1, %zmm10{%k5}
+
+/* Set sPIO2 to zero if den. is zero */
+ vpandnq %zmm3, %zmm10, %zmm3
+ vpandq %zmm10, %zmm8, %zmm1
+ vporq %zmm1, %zmm3, %zmm3
+ vorpd %zmm5, %zmm3, %zmm1
+ vmovups __svml_datan2_data_internal(%rip), %zmm5
+ vaddpd {rn-sae}, %zmm5, %zmm1, %zmm1{%k6}
+ vorpd %zmm4, %zmm1, %zmm1
+
+/* Merge results from main and spec path */
+ vpmovzxdq %ymm2, %zmm4
+ vpsllq $32, %zmm4, %zmm2
+ vpord %zmm2, %zmm4, %zmm3
+ vpandnq %zmm11, %zmm3, %zmm11
+ vpandq %zmm3, %zmm1, %zmm1
+ vporq %zmm1, %zmm11, %zmm11
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx r12 r13 r14 r15 edx zmm0 zmm7 zmm11
+END(_ZGVeN8vv_atan2_skx)
+
+ .section .rodata, "a"
+ .align 64
+
+#ifdef __svml_datan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(64)) VUINT32 dPI[8][2];
+ __declspec(align(64)) VUINT32 dPIO2[8][2];
+ __declspec(align(64)) VUINT32 dA19[8][2];
+ __declspec(align(64)) VUINT32 dA18[8][2];
+ __declspec(align(64)) VUINT32 dA17[8][2];
+ __declspec(align(64)) VUINT32 dA16[8][2];
+ __declspec(align(64)) VUINT32 dA15[8][2];
+ __declspec(align(64)) VUINT32 dA14[8][2];
+ __declspec(align(64)) VUINT32 dA13[8][2];
+ __declspec(align(64)) VUINT32 dA12[8][2];
+ __declspec(align(64)) VUINT32 dA11[8][2];
+ __declspec(align(64)) VUINT32 dA10[8][2];
+ __declspec(align(64)) VUINT32 dA09[8][2];
+ __declspec(align(64)) VUINT32 dA08[8][2];
+ __declspec(align(64)) VUINT32 dA07[8][2];
+ __declspec(align(64)) VUINT32 dA06[8][2];
+ __declspec(align(64)) VUINT32 dA05[8][2];
+ __declspec(align(64)) VUINT32 dA04[8][2];
+ __declspec(align(64)) VUINT32 dA03[8][2];
+ __declspec(align(64)) VUINT32 dA02[8][2];
+ __declspec(align(64)) VUINT32 dA01[8][2];
+ __declspec(align(64)) VUINT32 dA00[8][2];
+ __declspec(align(64)) VUINT32 dSIGN_MASK[8][2];
+ __declspec(align(64)) VUINT32 iCHK_WORK_SUB[16][1];
+ __declspec(align(64)) VUINT32 iCHK_WORK_CMP[16][1];
+ __declspec(align(64)) VUINT32 dABS_MASK[8][2];
+ __declspec(align(64)) VUINT32 dZERO[8][2];
+} __svml_datan2_data_internal;
+#endif
+__svml_datan2_data_internal:
+ .quad 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18, 0x400921FB54442D18 //dPI
+ .align 64
+ .quad 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18, 0x3FF921FB54442D18 //dPIO2
+ .align 64
+ .quad 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3, 0xBEF4FDB537ABC7A3 // dA19
+ .align 64
+ .quad 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209, 0x3F2CED0A36665209 // dA18
+ .align 64
+ .quad 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23, 0xBF52E67C93954C23 // dA17
+ .align 64
+ .quad 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3, 0x3F6F5A1DAE82AFB3 // dA16
+ .align 64
+ .quad 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD, 0xBF82B2EC618E4BAD // dA15
+ .align 64
+ .quad 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5, 0x3F914F4C661116A5 // dA14
+ .align 64
+ .quad 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C, 0xBF9A5E83B081F69C // dA13
+ .align 64
+ .quad 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F, 0x3FA169980CB6AD4F // dA12
+ .align 64
+ .quad 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC, 0xBFA4EFA2E563C1BC // dA11
+ .align 64
+ .quad 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B, 0x3FA7EC0FBC50683B // dA10
+ .align 64
+ .quad 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954, 0xBFAAD261EAA09954 // dA09
+ .align 64
+ .quad 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF, 0x3FAE1749BD612DCF // dA08
+ .align 64
+ .quad 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0, 0xBFB11084009435E0 // dA07
+ .align 64
+ .quad 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651, 0x3FB3B12A49295651 // dA06
+ .align 64
+ .quad 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94, 0xBFB745D009BADA94 // dA05
+ .align 64
+ .quad 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5, 0x3FBC71C707F7D5B5 // dA04
+ .align 64
+ .quad 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7, 0xBFC2492491EE55C7 // dA03
+ .align 64
+ .quad 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34, 0x3FC999999997EE34 // dA02
+ .align 64
+ .quad 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5, 0xBFD55555555553C5 // dA01
+ .align 64
+ .quad 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000, 0x3FF0000000000000 // dA00
+ .align 64
+ .quad 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000 //dSIGN_MASK
+ .align 64
+ .long 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000, 0x80300000 //iCHK_WORK_SUB
+ .align 64
+ .long 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000, 0xfdd00000 //iCHK_WORK_CMP
+ .align 64
+ .quad 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff //dABS_MASK
+ .align 64
+ .quad 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 //dZERO
+ .align 64
+ .type __svml_datan2_data_internal,@object
+ .size __svml_datan2_data_internal,.-__svml_datan2_data_internal
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core-avx2.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core-avx2.S
new file mode 100644
index 0000000..a2a76e8
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core-avx2.S
@@ -0,0 +1,20 @@
+/* AVX2 version of vectorized atan2f.
+ 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 _ZGVeN16vv_atan2f _ZGVeN16vv_atan2f_avx2_wrapper
+#include "../svml_s_atan2f16_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core.c b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core.c
new file mode 100644
index 0000000..6fa8064
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized atan2f, 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 _ZGVeN16vv_atan2f
+#include "ifunc-mathvec-avx512-skx.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVeN16vv_atan2f, __GI__ZGVeN16vv_atan2f,
+ __redirect__ZGVeN16vv_atan2f)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core_avx512.S
new file mode 100644
index 0000000..f3477cc
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f16_core_avx512.S
@@ -0,0 +1,399 @@
+/* Function atan2f 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_satan2_data_internal
+ */
+#define sZERO 0
+#define sONE 64
+#define sSIGN_MASK 128
+#define sABS_MASK 192
+#define sPIO2 256
+#define sPI 320
+#define sPC8 384
+#define sPC7 448
+#define sPC6 512
+#define sPC5 576
+#define sPC4 640
+#define sPC3 704
+#define sPC2 768
+#define sPC1 832
+#define sPC0 896
+#define iCHK_WORK_SUB 960
+#define iCHK_WORK_CMP 1024
+
+#include <sysdep.h>
+
+ .text
+ .section .text.exex512,"ax",@progbits
+ENTRY(_ZGVeN16vv_atan2f_skx)
+ pushq %rbp
+ cfi_def_cfa_offset(16)
+ movq %rsp, %rbp
+ cfi_def_cfa(6, 16)
+ cfi_offset(6, -16)
+ andq $-64, %rsp
+ subq $256, %rsp
+ xorl %edx, %edx
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Arguments signs
+ */
+ vmovups sABS_MASK+__svml_satan2_data_internal(%rip), %zmm6
+ vmovups sONE+__svml_satan2_data_internal(%rip), %zmm3
+
+/* Testing on working interval. */
+ vmovups iCHK_WORK_SUB+__svml_satan2_data_internal(%rip), %zmm9
+ vmovups iCHK_WORK_CMP+__svml_satan2_data_internal(%rip), %zmm14
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ vmovups sPIO2+__svml_satan2_data_internal(%rip), %zmm4
+ vpternlogd $255, %zmm13, %zmm13, %zmm13
+ vmovaps %zmm1, %zmm8
+ vandps %zmm6, %zmm8, %zmm2
+ vandps %zmm6, %zmm0, %zmm1
+ vorps sSIGN_MASK+__svml_satan2_data_internal(%rip), %zmm2, %zmm5
+ vpsubd %zmm9, %zmm2, %zmm10
+ vpsubd %zmm9, %zmm1, %zmm12
+ vxorps %zmm2, %zmm8, %zmm7
+ vxorps %zmm1, %zmm0, %zmm6
+ vcmpps $17, {sae}, %zmm2, %zmm1, %k1
+ vpcmpgtd %zmm10, %zmm14, %k2
+ vpcmpgtd %zmm12, %zmm14, %k3
+ vmovups sPC6+__svml_satan2_data_internal(%rip), %zmm14
+ vblendmps %zmm1, %zmm5, %zmm11{%k1}
+ vblendmps %zmm2, %zmm1, %zmm5{%k1}
+ vxorps %zmm4, %zmm4, %zmm4{%k1}
+
+/*
+ * Division a/b.
+ * Enabled when FMA is available and
+ * performance is better with NR iteration
+ */
+ vrcp14ps %zmm5, %zmm15
+ vfnmadd231ps {rn-sae}, %zmm5, %zmm15, %zmm3
+ vfmadd213ps {rn-sae}, %zmm15, %zmm3, %zmm15
+ vmulps {rn-sae}, %zmm15, %zmm11, %zmm3
+ vfnmadd231ps {rn-sae}, %zmm5, %zmm3, %zmm11
+ vfmadd213ps {rn-sae}, %zmm3, %zmm11, %zmm15
+ vmovups sPC8+__svml_satan2_data_internal(%rip), %zmm11
+ vpternlogd $255, %zmm3, %zmm3, %zmm3
+
+/* Polynomial. */
+ vmulps {rn-sae}, %zmm15, %zmm15, %zmm9
+ vpandnd %zmm10, %zmm10, %zmm13{%k2}
+ vmulps {rn-sae}, %zmm9, %zmm9, %zmm10
+ vfmadd231ps {rn-sae}, %zmm10, %zmm11, %zmm14
+ vmovups sPC5+__svml_satan2_data_internal(%rip), %zmm11
+ vpandnd %zmm12, %zmm12, %zmm3{%k3}
+ vpord %zmm3, %zmm13, %zmm3
+ vmovups sPC4+__svml_satan2_data_internal(%rip), %zmm13
+ vmovups sPC7+__svml_satan2_data_internal(%rip), %zmm12
+ vptestmd %zmm3, %zmm3, %k0
+ vfmadd213ps {rn-sae}, %zmm13, %zmm10, %zmm14
+ vfmadd231ps {rn-sae}, %zmm10, %zmm12, %zmm11
+ vmovups sPC3+__svml_satan2_data_internal(%rip), %zmm12
+ vmovups sPC2+__svml_satan2_data_internal(%rip), %zmm13
+
+/* Special branch for fast (vector) processing of zero arguments */
+ kortestw %k0, %k0
+ vfmadd213ps {rn-sae}, %zmm12, %zmm10, %zmm11
+ vmovups sPC1+__svml_satan2_data_internal(%rip), %zmm12
+ vfmadd213ps {rn-sae}, %zmm13, %zmm10, %zmm14
+ vmovups sPC0+__svml_satan2_data_internal(%rip), %zmm13
+ vfmadd213ps {rn-sae}, %zmm12, %zmm10, %zmm11
+ vfmadd213ps {rn-sae}, %zmm13, %zmm10, %zmm14
+ vfmadd213ps {rn-sae}, %zmm14, %zmm9, %zmm11
+
+/* Reconstruction. */
+ vfmadd213ps {rn-sae}, %zmm4, %zmm15, %zmm11
+
+/* if x<0, sPI = Pi, else sPI =0 */
+ vmovups __svml_satan2_data_internal(%rip), %zmm15
+ vorps %zmm7, %zmm11, %zmm9
+ vcmpps $18, {sae}, %zmm15, %zmm8, %k4
+ vmovups sPI+__svml_satan2_data_internal(%rip), %zmm11
+ vaddps {rn-sae}, %zmm11, %zmm9, %zmm9{%k4}
+ vorps %zmm6, %zmm9, %zmm10
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm10 zmm11
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx zmm0 zmm8 zmm10
+
+/* Restore registers
+ * and exit the function
+ */
+
+L(EXIT):
+ vmovaps %zmm10, %zmm0
+ 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 %zmm0, 64(%rsp)
+ vmovups %zmm8, 128(%rsp)
+ vmovups %zmm10, 192(%rsp)
+ # LOE rbx r12 r13 r14 r15 edx zmm10
+
+ 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: -64; DW_OP_and; DW_OP_const4s: -240; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x10, 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: -248; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x08, 0xff, 0xff, 0xff, 0x22
+ movl %edx, %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: -256; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x00, 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 192(%rsp), %zmm10
+
+/* 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: -240; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x10, 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: -248; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x08, 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: -256; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xc0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x00, 0xff, 0xff, 0xff, 0x22
+ # LOE rbx r12 r13 r14 r15 zmm10
+
+/* Scalar math fucntion call
+ * to process special input
+ */
+
+L(SCALAR_MATH_CALL):
+ movl %r12d, %r14d
+ movss 64(%rsp,%r14,4), %xmm0
+ movss 128(%rsp,%r14,4), %xmm1
+ call atan2f@PLT
+ # LOE rbx r14 r15 r12d r13d xmm0
+
+ movss %xmm0, 192(%rsp,%r14,4)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ vmovups __svml_satan2_data_internal(%rip), %zmm9
+
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ vcmpps $3, {sae}, %zmm8, %zmm8, %k1
+ vcmpps $3, {sae}, %zmm0, %zmm0, %k2
+ vpcmpd $4, %zmm9, %zmm2, %k3
+ vpcmpd $4, %zmm9, %zmm1, %k4
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ vcmpps $4, {sae}, %zmm9, %zmm5, %k5
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ vpcmpgtd %zmm8, %zmm9, %k6
+ vpternlogd $255, %zmm14, %zmm14, %zmm14
+ vpternlogd $255, %zmm12, %zmm12, %zmm12
+ vpternlogd $255, %zmm13, %zmm13, %zmm13
+ vpandnd %zmm2, %zmm2, %zmm14{%k3}
+ vpternlogd $255, %zmm2, %zmm2, %zmm2
+ vpandnd %zmm1, %zmm1, %zmm2{%k4}
+ vpord %zmm2, %zmm14, %zmm15
+ vpternlogd $255, %zmm2, %zmm2, %zmm2
+ vpandnd %zmm5, %zmm5, %zmm2{%k5}
+
+/* Set sPIO2 to zero if den. is zero */
+ vpandnd %zmm4, %zmm2, %zmm4
+ vpandd %zmm2, %zmm9, %zmm5
+ vpord %zmm5, %zmm4, %zmm2
+ vorps %zmm7, %zmm2, %zmm7
+ vaddps {rn-sae}, %zmm11, %zmm7, %zmm7{%k6}
+ vorps %zmm6, %zmm7, %zmm6
+ vpandnd %zmm8, %zmm8, %zmm12{%k1}
+ vpandnd %zmm0, %zmm0, %zmm13{%k2}
+ vandps %zmm13, %zmm12, %zmm12
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ vpandd %zmm12, %zmm15, %zmm1
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ vpandnd %zmm3, %zmm1, %zmm3
+
+/* Go to callout */
+ vptestmd %zmm3, %zmm3, %k0
+ kmovw %k0, %edx
+
+/* Merge results from main and spec path */
+ vpandnd %zmm10, %zmm1, %zmm10
+ vpandd %zmm1, %zmm6, %zmm11
+ vpord %zmm11, %zmm10, %zmm10
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx r12 r13 r14 r15 edx zmm0 zmm8 zmm10
+END(_ZGVeN16vv_atan2f_skx)
+
+ .section .rodata, "a"
+ .align 64
+
+#ifdef __svml_satan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(64)) VUINT32 sZERO[16][1];
+ __declspec(align(64)) VUINT32 sONE[16][1];
+ __declspec(align(64)) VUINT32 sSIGN_MASK[16][1];
+ __declspec(align(64)) VUINT32 sABS_MASK[16][1];
+ __declspec(align(64)) VUINT32 sPIO2[16][1];
+ __declspec(align(64)) VUINT32 sPI[16][1];
+ __declspec(align(64)) VUINT32 sPC8[16][1];
+ __declspec(align(64)) VUINT32 sPC7[16][1];
+ __declspec(align(64)) VUINT32 sPC6[16][1];
+ __declspec(align(64)) VUINT32 sPC5[16][1];
+ __declspec(align(64)) VUINT32 sPC4[16][1];
+ __declspec(align(64)) VUINT32 sPC3[16][1];
+ __declspec(align(64)) VUINT32 sPC2[16][1];
+ __declspec(align(64)) VUINT32 sPC1[16][1];
+ __declspec(align(64)) VUINT32 sPC0[16][1];
+ __declspec(align(64)) VUINT32 iCHK_WORK_SUB[16][1];
+ __declspec(align(64)) VUINT32 iCHK_WORK_CMP[16][1];
+} __svml_satan2_data_internal;
+#endif
+__svml_satan2_data_internal:
+ .long 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 // sZERO
+ .align 64
+ .long 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 // sONE
+ .align 64
+ .long 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000 // sSIGN_MASK
+ .align 64
+ .long 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF // sABS_MASK
+ .align 64
+ .long 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB // sPIO2
+ .align 64
+ .long 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB // sPI
+ .align 64
+ .long 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0 // sA08
+ .align 64
+ .long 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631 // sA07
+ .align 64
+ .long 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384 // sA06
+ .align 64
+ .long 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629 // sA05
+ .align 64
+ .long 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474 // sA04
+ .align 64
+ .long 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8 // sA03
+ .align 64
+ .long 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F // sA02
+ .align 64
+ .long 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49 // sA01
+ .align 64
+ .long 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 // sA00
+ .align 64
+ .long 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000 //iCHK_WORK_SUB
+ .align 64
+ .long 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000 //iCHK_WORK_CMP
+ .align 64
+ .type __svml_satan2_data_internal,@object
+ .size __svml_satan2_data_internal,.-__svml_satan2_data_internal
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core-sse2.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core-sse2.S
new file mode 100644
index 0000000..d1a67fa
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core-sse2.S
@@ -0,0 +1,20 @@
+/* SSE2 version of vectorized atan2f.
+ 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 _ZGVbN4vv_atan2f _ZGVbN4vv_atan2f_sse2
+#include "../svml_s_atan2f4_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core.c b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core.c
new file mode 100644
index 0000000..ee882b0
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized atan2f, 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 _ZGVbN4vv_atan2f
+#include "ifunc-mathvec-sse4_1.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVbN4vv_atan2f, __GI__ZGVbN4vv_atan2f,
+ __redirect__ZGVbN4vv_atan2f)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core_sse4.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core_sse4.S
new file mode 100644
index 0000000..e4fbe82
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f4_core_sse4.S
@@ -0,0 +1,384 @@
+/* Function atan2f 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_satan2_data_internal
+ */
+#define sZERO 0
+#define sSIGN_MASK 16
+#define sABS_MASK 32
+#define sPIO2 48
+#define sPI 64
+#define sPC8 80
+#define sPC7 96
+#define sPC6 112
+#define sPC5 128
+#define sPC4 144
+#define sPC3 160
+#define sPC2 176
+#define sPC1 192
+#define sPC0 208
+#define iCHK_WORK_SUB 224
+#define iCHK_WORK_CMP 240
+
+#include <sysdep.h>
+
+ .text
+ .section .text.sse4,"ax",@progbits
+ENTRY(_ZGVbN4vv_atan2f_sse4)
+ subq $88, %rsp
+ cfi_def_cfa_offset(96)
+ movaps %xmm0, %xmm12
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Arguments signs
+ */
+ movups sABS_MASK+__svml_satan2_data_internal(%rip), %xmm10
+ movaps %xmm1, %xmm13
+ movaps %xmm10, %xmm11
+ andps %xmm12, %xmm10
+ andps %xmm13, %xmm11
+ movaps %xmm10, %xmm7
+ cmpltps %xmm11, %xmm7
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ movups sSIGN_MASK+__svml_satan2_data_internal(%rip), %xmm6
+ movaps %xmm7, %xmm0
+ orps %xmm11, %xmm6
+ movaps %xmm10, %xmm4
+ andnps %xmm6, %xmm0
+ movaps %xmm7, %xmm6
+ movaps %xmm11, %xmm5
+ andps %xmm7, %xmm4
+ andnps %xmm10, %xmm6
+ andps %xmm7, %xmm5
+ orps %xmm4, %xmm0
+ orps %xmm5, %xmm6
+
+/* Division a/b. */
+ divps %xmm6, %xmm0
+
+/* Testing on working interval. */
+ movdqu iCHK_WORK_SUB+__svml_satan2_data_internal(%rip), %xmm14
+ movaps %xmm11, %xmm15
+ movaps %xmm10, %xmm3
+ psubd %xmm14, %xmm15
+ psubd %xmm14, %xmm3
+ movdqa %xmm15, %xmm1
+ movdqu iCHK_WORK_CMP+__svml_satan2_data_internal(%rip), %xmm2
+ movdqa %xmm3, %xmm14
+ pcmpgtd %xmm2, %xmm1
+ pcmpeqd %xmm2, %xmm15
+ pcmpgtd %xmm2, %xmm14
+ pcmpeqd %xmm2, %xmm3
+ por %xmm15, %xmm1
+ por %xmm3, %xmm14
+ por %xmm14, %xmm1
+
+/* Polynomial. */
+ movaps %xmm0, %xmm14
+ mulps %xmm0, %xmm14
+ movaps %xmm13, %xmm4
+ movmskps %xmm1, %ecx
+ movaps %xmm14, %xmm15
+ movaps %xmm11, %xmm9
+ mulps %xmm14, %xmm15
+ pxor %xmm13, %xmm9
+ movups sPC8+__svml_satan2_data_internal(%rip), %xmm2
+ movaps %xmm10, %xmm8
+ mulps %xmm15, %xmm2
+ pxor %xmm12, %xmm8
+ movups sPC7+__svml_satan2_data_internal(%rip), %xmm3
+ xorl %edx, %edx
+ mulps %xmm15, %xmm3
+ addps sPC6+__svml_satan2_data_internal(%rip), %xmm2
+ mulps %xmm15, %xmm2
+ addps sPC5+__svml_satan2_data_internal(%rip), %xmm3
+ mulps %xmm15, %xmm3
+ addps sPC4+__svml_satan2_data_internal(%rip), %xmm2
+ mulps %xmm15, %xmm2
+ addps sPC3+__svml_satan2_data_internal(%rip), %xmm3
+ mulps %xmm15, %xmm3
+ addps sPC2+__svml_satan2_data_internal(%rip), %xmm2
+ mulps %xmm2, %xmm15
+ addps sPC1+__svml_satan2_data_internal(%rip), %xmm3
+ mulps %xmm3, %xmm14
+ addps sPC0+__svml_satan2_data_internal(%rip), %xmm15
+
+/* if x<0, sPI = Pi, else sPI =0 */
+ movups __svml_satan2_data_internal(%rip), %xmm5
+ xorl %eax, %eax
+ andnps sPIO2+__svml_satan2_data_internal(%rip), %xmm7
+ addps %xmm14, %xmm15
+ cmpleps %xmm5, %xmm4
+
+/* Reconstruction. */
+ mulps %xmm15, %xmm0
+ andps sPI+__svml_satan2_data_internal(%rip), %xmm4
+ addps %xmm7, %xmm0
+ orps %xmm9, %xmm0
+ addps %xmm4, %xmm0
+ orps %xmm8, %xmm0
+
+/* Special branch for fast (vector) processing of zero arguments */
+ testl %ecx, %ecx
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm1 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm12 xmm13
+
+/* Restore registers
+ * and exit the function
+ */
+
+L(EXIT):
+ addq $88, %rsp
+ cfi_def_cfa_offset(8)
+ ret
+ cfi_def_cfa_offset(96)
+
+/* Branch to process
+ * special inputs
+ */
+
+L(SPECIAL_VALUES_BRANCH):
+ movups %xmm12, 32(%rsp)
+ movups %xmm13, 48(%rsp)
+ movups %xmm0, 64(%rsp)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0
+
+ movq %r12, 16(%rsp)
+ cfi_offset(12, -80)
+ movl %eax, %r12d
+ movq %r13, 8(%rsp)
+ cfi_offset(13, -88)
+ movl %edx, %r13d
+ movq %r14, (%rsp)
+ cfi_offset(14, -96)
+ # 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 64(%rsp), %xmm0
+
+/* Go to exit */
+ jmp L(EXIT)
+ cfi_offset(12, -80)
+ cfi_offset(13, -88)
+ cfi_offset(14, -96)
+ # LOE rbx rbp r12 r13 r14 r15 xmm0
+
+/* Scalar math fucntion call
+ * to process special input
+ */
+
+L(SCALAR_MATH_CALL):
+ movl %r12d, %r14d
+ movss 32(%rsp,%r14,4), %xmm0
+ movss 48(%rsp,%r14,4), %xmm1
+ call atan2f@PLT
+ # LOE rbx rbp r14 r15 r12d r13d xmm0
+
+ movss %xmm0, 64(%rsp,%r14,4)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx rbp r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ movaps %xmm13, %xmm3
+ movaps %xmm12, %xmm2
+ cmpordps %xmm13, %xmm3
+ cmpordps %xmm12, %xmm2
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ cmpeqps %xmm5, %xmm6
+
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ pcmpeqd %xmm5, %xmm11
+ pcmpeqd %xmm5, %xmm10
+ andps %xmm2, %xmm3
+ por %xmm10, %xmm11
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ andps %xmm3, %xmm11
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ movaps %xmm11, %xmm10
+ pandn %xmm1, %xmm10
+
+/* Set sPIO2 to zero if den. is zero */
+ movaps %xmm6, %xmm1
+ andnps %xmm7, %xmm1
+ andps %xmm5, %xmm6
+ orps %xmm6, %xmm1
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ pcmpgtd %xmm13, %xmm5
+ orps %xmm9, %xmm1
+ andps %xmm4, %xmm5
+
+/* Merge results from main and spec path */
+ movaps %xmm11, %xmm4
+ addps %xmm5, %xmm1
+
+/* Go to callout */
+ movmskps %xmm10, %edx
+ orps %xmm8, %xmm1
+ andnps %xmm0, %xmm4
+ andps %xmm11, %xmm1
+ movaps %xmm4, %xmm0
+ orps %xmm1, %xmm0
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx rbp r12 r13 r14 r15 eax edx xmm0 xmm12 xmm13
+END(_ZGVbN4vv_atan2f_sse4)
+
+ .section .rodata, "a"
+ .align 16
+
+#ifdef __svml_satan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(16)) VUINT32 sZERO[4][1];
+ __declspec(align(16)) VUINT32 sSIGN_MASK[4][1];
+ __declspec(align(16)) VUINT32 sABS_MASK[4][1];
+ __declspec(align(16)) VUINT32 sPIO2[4][1];
+ __declspec(align(16)) VUINT32 sPI[4][1];
+ __declspec(align(16)) VUINT32 sPC8[4][1];
+ __declspec(align(16)) VUINT32 sPC7[4][1];
+ __declspec(align(16)) VUINT32 sPC6[4][1];
+ __declspec(align(16)) VUINT32 sPC5[4][1];
+ __declspec(align(16)) VUINT32 sPC4[4][1];
+ __declspec(align(16)) VUINT32 sPC3[4][1];
+ __declspec(align(16)) VUINT32 sPC2[4][1];
+ __declspec(align(16)) VUINT32 sPC1[4][1];
+ __declspec(align(16)) VUINT32 sPC0[4][1];
+ __declspec(align(16)) VUINT32 iCHK_WORK_SUB[4][1];
+ __declspec(align(16)) VUINT32 iCHK_WORK_CMP[4][1];
+} __svml_satan2_data_internal;
+#endif
+__svml_satan2_data_internal:
+ .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 // sZERO
+ .align 16
+ .long 0x80000000, 0x80000000, 0x80000000, 0x80000000 // sSIGN_MASK
+ .align 16
+ .long 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF // sABS_MASK
+ .align 16
+ .long 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB // sPIO2
+ .align 16
+ .long 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB // sPI
+ .align 16
+ .long 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0 // sA08
+ .align 16
+ .long 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631 // sA07
+ .align 16
+ .long 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384 // sA06
+ .align 16
+ .long 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629 // sA05
+ .align 16
+ .long 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474 // sA04
+ .align 16
+ .long 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8 // sA03
+ .align 16
+ .long 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F // sA02
+ .align 16
+ .long 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49 // sA01
+ .align 16
+ .long 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 // sA00
+ .align 16
+ .long 0x81000000, 0x81000000, 0x81000000, 0x81000000 //iCHK_WORK_SUB
+ .align 16
+ .long 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000 //iCHK_WORK_CMP
+ .align 16
+ .type __svml_satan2_data_internal,@object
+ .size __svml_satan2_data_internal,.-__svml_satan2_data_internal
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core-sse.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core-sse.S
new file mode 100644
index 0000000..21b1d3f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core-sse.S
@@ -0,0 +1,20 @@
+/* SSE version of vectorized atan2f.
+ 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 _ZGVdN8vv_atan2f _ZGVdN8vv_atan2f_sse_wrapper
+#include "../svml_s_atan2f8_core.S"
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core.c b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core.c
new file mode 100644
index 0000000..7e02050
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core.c
@@ -0,0 +1,28 @@
+/* Multiple versions of vectorized sinf, 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 _ZGVdN8vv_atan2f
+#include "ifunc-mathvec-avx2.h"
+
+libc_ifunc_redirected (REDIRECT_NAME, SYMBOL_NAME, IFUNC_SELECTOR ());
+
+#ifdef SHARED
+__hidden_ver1 (_ZGVdN8vv_atan2f, __GI__ZGVdN8vv_atan2f,
+ __redirect__ZGVdN8vv_atan2f)
+ __attribute__ ((visibility ("hidden")));
+#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core_avx2.S b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core_avx2.S
new file mode 100644
index 0000000..2e6e5eb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atan2f8_core_avx2.S
@@ -0,0 +1,362 @@
+/* Function atan2f 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:
+ * For 0.0 <= x <= 7.0/16.0: atan(x) = atan(0.0) + atan(s), where s=(x-0.0)/(1.0+0.0*x)
+ * For 7.0/16.0 <= x <= 11.0/16.0: atan(x) = atan(0.5) + atan(s), where s=(x-0.5)/(1.0+0.5*x)
+ * For 11.0/16.0 <= x <= 19.0/16.0: atan(x) = atan(1.0) + atan(s), where s=(x-1.0)/(1.0+1.0*x)
+ * For 19.0/16.0 <= x <= 39.0/16.0: atan(x) = atan(1.5) + atan(s), where s=(x-1.5)/(1.0+1.5*x)
+ * For 39.0/16.0 <= x <= inf : atan(x) = atan(inf) + atan(s), where s=-1.0/x
+ * Where atan(s) ~= s+s^3*Poly11(s^2) on interval |s|<7.0/0.16.
+ *
+ *
+ */
+
+/* Offsets for data table __svml_satan2_data_internal
+ */
+#define sZERO 0
+#define sSIGN_MASK 32
+#define sABS_MASK 64
+#define sPIO2 96
+#define sPI 128
+#define sPC8 160
+#define sPC7 192
+#define sPC6 224
+#define sPC5 256
+#define sPC4 288
+#define sPC3 320
+#define sPC2 352
+#define sPC1 384
+#define sPC0 416
+#define iCHK_WORK_SUB 448
+#define iCHK_WORK_CMP 480
+
+#include <sysdep.h>
+
+ .text
+ .section .text.avx2,"ax",@progbits
+ENTRY(_ZGVdN8vv_atan2f_avx2)
+ pushq %rbp
+ cfi_def_cfa_offset(16)
+ movq %rsp, %rbp
+ cfi_def_cfa(6, 16)
+ cfi_offset(6, -16)
+ andq $-32, %rsp
+ subq $128, %rsp
+ xorl %edx, %edx
+
+/*
+ * #define NO_VECTOR_ZERO_ATAN2_ARGS
+ * Declarations
+ * Variables
+ * Constants
+ * The end of declarations
+ * Implementation
+ * Arguments signs
+ */
+ vmovups sABS_MASK+__svml_satan2_data_internal(%rip), %ymm2
+
+/* Testing on working interval. */
+ vmovups iCHK_WORK_SUB+__svml_satan2_data_internal(%rip), %ymm15
+ vmovups iCHK_WORK_CMP+__svml_satan2_data_internal(%rip), %ymm9
+
+/* if x<0, sPI = Pi, else sPI =0 */
+ vmovups __svml_satan2_data_internal(%rip), %ymm5
+ vmovaps %ymm1, %ymm7
+ vandps %ymm2, %ymm7, %ymm13
+ vandps %ymm2, %ymm0, %ymm12
+ vcmplt_oqps %ymm13, %ymm12, %ymm4
+ vcmple_oqps %ymm5, %ymm7, %ymm6
+ vpsubd %ymm15, %ymm13, %ymm10
+ vpsubd %ymm15, %ymm12, %ymm8
+
+/*
+ * 1) If y<x then a= y, b=x, PIO2=0
+ * 2) If y>x then a=-x, b=y, PIO2=Pi/2
+ */
+ vorps sSIGN_MASK+__svml_satan2_data_internal(%rip), %ymm13, %ymm3
+ vblendvps %ymm4, %ymm12, %ymm3, %ymm14
+ vblendvps %ymm4, %ymm13, %ymm12, %ymm3
+
+/* Division a/b. */
+ vdivps %ymm3, %ymm14, %ymm11
+ vpcmpgtd %ymm9, %ymm10, %ymm14
+ vpcmpeqd %ymm9, %ymm10, %ymm15
+ vpor %ymm15, %ymm14, %ymm10
+ vmovups sPC7+__svml_satan2_data_internal(%rip), %ymm15
+ vpcmpgtd %ymm9, %ymm8, %ymm14
+ vpcmpeqd %ymm9, %ymm8, %ymm8
+ vpor %ymm8, %ymm14, %ymm9
+ vmovups sPC8+__svml_satan2_data_internal(%rip), %ymm14
+ vpor %ymm9, %ymm10, %ymm10
+
+/* Polynomial. */
+ vmulps %ymm11, %ymm11, %ymm9
+ vmulps %ymm9, %ymm9, %ymm8
+ vfmadd213ps sPC6+__svml_satan2_data_internal(%rip), %ymm8, %ymm14
+ vfmadd213ps sPC5+__svml_satan2_data_internal(%rip), %ymm8, %ymm15
+ vfmadd213ps sPC4+__svml_satan2_data_internal(%rip), %ymm8, %ymm14
+ vfmadd213ps sPC3+__svml_satan2_data_internal(%rip), %ymm8, %ymm15
+ vfmadd213ps sPC2+__svml_satan2_data_internal(%rip), %ymm8, %ymm14
+ vfmadd213ps sPC1+__svml_satan2_data_internal(%rip), %ymm8, %ymm15
+ vfmadd213ps sPC0+__svml_satan2_data_internal(%rip), %ymm8, %ymm14
+ vfmadd213ps %ymm14, %ymm9, %ymm15
+ vandnps sPIO2+__svml_satan2_data_internal(%rip), %ymm4, %ymm4
+
+/* Reconstruction. */
+ vfmadd213ps %ymm4, %ymm11, %ymm15
+ vxorps %ymm13, %ymm7, %ymm1
+ vandps sPI+__svml_satan2_data_internal(%rip), %ymm6, %ymm6
+ vorps %ymm1, %ymm15, %ymm11
+ vaddps %ymm11, %ymm6, %ymm8
+ vmovmskps %ymm10, %eax
+ vxorps %ymm12, %ymm0, %ymm2
+ vorps %ymm2, %ymm8, %ymm9
+
+/* Special branch for fast (vector) processing of zero arguments */
+ testl %eax, %eax
+
+/* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm9 ymm10 ymm12 ymm13
+
+/* Return from auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH_RETURN):
+/*
+ * Special branch for fast (vector) processing of zero arguments
+ * The end of implementation
+ */
+ testl %edx, %edx
+
+/* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE rbx r12 r13 r14 r15 edx ymm0 ymm7 ymm9
+
+/* Restore registers
+ * and exit the function
+ */
+
+L(EXIT):
+ vmovaps %ymm9, %ymm0
+ 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 %ymm0, 32(%rsp)
+ vmovups %ymm7, 64(%rsp)
+ vmovups %ymm9, 96(%rsp)
+ # LOE rbx r12 r13 r14 r15 edx ymm9
+
+ 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: -112; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x90, 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: -120; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x88, 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: -128; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x80, 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 96(%rsp), %ymm9
+
+/* 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: -112; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x90, 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: -120; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x88, 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: -128; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0e, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x80, 0xff, 0xff, 0xff, 0x22
+ # LOE rbx r12 r13 r14 r15 ymm9
+
+/* Scalar math fucntion call
+ * to process special input
+ */
+
+L(SCALAR_MATH_CALL):
+ movl %r12d, %r14d
+ movss 32(%rsp,%r14,4), %xmm0
+ movss 64(%rsp,%r14,4), %xmm1
+ call atan2f@PLT
+ # LOE rbx r14 r15 r12d r13d xmm0
+
+ movss %xmm0, 96(%rsp,%r14,4)
+
+/* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ cfi_restore(14)
+ # LOE rbx r15 r12d r13d
+
+/* Auxilary branch
+ * for out of main path inputs
+ */
+
+L(AUX_BRANCH):
+/* Check if at least on of Y or Y is zero: iAXAYZERO */
+ vpcmpeqd %ymm5, %ymm13, %ymm13
+ vpcmpeqd %ymm5, %ymm12, %ymm12
+
+/* Check if both X & Y are not NaNs: iXYnotNAN */
+ vcmpordps %ymm7, %ymm7, %ymm11
+ vcmpordps %ymm0, %ymm0, %ymm14
+
+/*
+ * Path for zero arguments (at least one of both)
+ * Check if both args are zeros (den. is zero)
+ */
+ vcmpeqps %ymm5, %ymm3, %ymm3
+ vpor %ymm12, %ymm13, %ymm15
+
+/* Set sPIO2 to zero if den. is zero */
+ vblendvps %ymm3, %ymm5, %ymm4, %ymm4
+ vandps %ymm14, %ymm11, %ymm8
+
+/* Check if at least on of Y or Y is zero and not NaN: iAXAYZEROnotNAN */
+ vpand %ymm8, %ymm15, %ymm8
+
+/* Res = sign(Y)*(X<0)?(PIO2+PI):PIO2 */
+ vpcmpgtd %ymm7, %ymm5, %ymm5
+ vorps %ymm1, %ymm4, %ymm1
+ vandps %ymm6, %ymm5, %ymm6
+ vaddps %ymm6, %ymm1, %ymm1
+
+/* Exclude from previous callout mask zero (and not NaN) arguments */
+ vpandn %ymm10, %ymm8, %ymm10
+ vorps %ymm2, %ymm1, %ymm2
+
+/* Go to callout */
+ vmovmskps %ymm10, %edx
+
+/* Merge results from main and spec path */
+ vblendvps %ymm8, %ymm2, %ymm9, %ymm9
+
+/* Return to main vector processing path */
+ jmp L(AUX_BRANCH_RETURN)
+ # LOE rbx r12 r13 r14 r15 edx ymm0 ymm7 ymm9
+END(_ZGVdN8vv_atan2f_avx2)
+
+ .section .rodata, "a"
+ .align 32
+
+#ifdef __svml_satan2_data_internal_typedef
+typedef unsigned int VUINT32;
+typedef struct {
+ __declspec(align(32)) VUINT32 sZERO[8][1];
+ __declspec(align(32)) VUINT32 sSIGN_MASK[8][1];
+ __declspec(align(32)) VUINT32 sABS_MASK[8][1];
+ __declspec(align(32)) VUINT32 sPIO2[8][1];
+ __declspec(align(32)) VUINT32 sPI[8][1];
+ __declspec(align(32)) VUINT32 sPC8[8][1];
+ __declspec(align(32)) VUINT32 sPC7[8][1];
+ __declspec(align(32)) VUINT32 sPC6[8][1];
+ __declspec(align(32)) VUINT32 sPC5[8][1];
+ __declspec(align(32)) VUINT32 sPC4[8][1];
+ __declspec(align(32)) VUINT32 sPC3[8][1];
+ __declspec(align(32)) VUINT32 sPC2[8][1];
+ __declspec(align(32)) VUINT32 sPC1[8][1];
+ __declspec(align(32)) VUINT32 sPC0[8][1];
+ __declspec(align(32)) VUINT32 iCHK_WORK_SUB[8][1];
+ __declspec(align(32)) VUINT32 iCHK_WORK_CMP[8][1];
+} __svml_satan2_data_internal;
+#endif
+__svml_satan2_data_internal:
+ .long 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 // sZERO
+ .align 32
+ .long 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000 // sSIGN_MASK
+ .align 32
+ .long 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF // sABS_MASK
+ .align 32
+ .long 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB, 0x3FC90FDB // sPIO2
+ .align 32
+ .long 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB, 0x40490FDB // sPI
+ .align 32
+ .long 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0, 0x3B322CC0 // sA08
+ .align 32
+ .long 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631, 0xBC7F2631 // sA07
+ .align 32
+ .long 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384, 0x3D2BC384 // sA06
+ .align 32
+ .long 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629, 0xBD987629 // sA05
+ .align 32
+ .long 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474, 0x3DD96474 // sA04
+ .align 32
+ .long 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8, 0xBE1161F8 // sA03
+ .align 32
+ .long 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F, 0x3E4CB79F // sA02
+ .align 32
+ .long 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49, 0xBEAAAA49 // sA01
+ .align 32
+ .long 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 // sA00
+ .align 32
+ .long 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000, 0x81000000 //iCHK_WORK_SUB
+ .align 32
+ .long 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000, 0xFC000000 //iCHK_WORK_CMP
+ .align 32
+ .type __svml_satan2_data_internal,@object
+ .size __svml_satan2_data_internal,.-__svml_satan2_data_internal
diff --git a/sysdeps/x86_64/fpu/svml_d_atan22_core.S b/sysdeps/x86_64/fpu/svml_d_atan22_core.S
new file mode 100644
index 0000000..f3089e7
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_d_atan22_core.S
@@ -0,0 +1,29 @@
+/* Function atan2 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 (_ZGVbN2vv_atan2)
+WRAPPER_IMPL_SSE2_ff atan2
+END (_ZGVbN2vv_atan2)
+
+#ifndef USE_MULTIARCH
+ libmvec_hidden_def (_ZGVbN2vv_atan2)
+#endif
diff --git a/sysdeps/x86_64/fpu/svml_d_atan24_core.S b/sysdeps/x86_64/fpu/svml_d_atan24_core.S
new file mode 100644
index 0000000..8a163d1
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_d_atan24_core.S
@@ -0,0 +1,29 @@
+/* Function atan2 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 (_ZGVdN4vv_atan2)
+WRAPPER_IMPL_AVX_ff _ZGVbN2vv_atan2
+END (_ZGVdN4vv_atan2)
+
+#ifndef USE_MULTIARCH
+ libmvec_hidden_def (_ZGVdN4vv_atan2)
+#endif
diff --git a/sysdeps/x86_64/fpu/svml_d_atan24_core_avx.S b/sysdeps/x86_64/fpu/svml_d_atan24_core_avx.S
new file mode 100644
index 0000000..0ee5ae8
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_d_atan24_core_avx.S
@@ -0,0 +1,25 @@
+/* Function atan2 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 (_ZGVcN4vv_atan2)
+WRAPPER_IMPL_AVX_ff _ZGVbN2vv_atan2
+END (_ZGVcN4vv_atan2)
diff --git a/sysdeps/x86_64/fpu/svml_d_atan28_core.S b/sysdeps/x86_64/fpu/svml_d_atan28_core.S
new file mode 100644
index 0000000..b85f696
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_d_atan28_core.S
@@ -0,0 +1,25 @@
+/* Function atan2 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_d_wrapper_impl.h"
+
+ .text
+ENTRY (_ZGVeN8vv_atan2)
+WRAPPER_IMPL_AVX512_ff _ZGVdN4vv_atan2
+END (_ZGVeN8vv_atan2)
diff --git a/sysdeps/x86_64/fpu/svml_s_atan2f16_core.S b/sysdeps/x86_64/fpu/svml_s_atan2f16_core.S
new file mode 100644
index 0000000..25acb31
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_s_atan2f16_core.S
@@ -0,0 +1,25 @@
+/* Function atan2f 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 (_ZGVeN16vv_atan2f)
+WRAPPER_IMPL_AVX512_ff _ZGVdN8vv_atan2f
+END (_ZGVeN16vv_atan2f)
diff --git a/sysdeps/x86_64/fpu/svml_s_atan2f4_core.S b/sysdeps/x86_64/fpu/svml_s_atan2f4_core.S
new file mode 100644
index 0000000..bc99f0b
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_s_atan2f4_core.S
@@ -0,0 +1,29 @@
+/* Function atan2f 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_s_wrapper_impl.h"
+
+ .text
+ENTRY (_ZGVbN4vv_atan2f)
+WRAPPER_IMPL_SSE2_ff atan2f
+END (_ZGVbN4vv_atan2f)
+
+#ifndef USE_MULTIARCH
+ libmvec_hidden_def (_ZGVbN4vv_atan2f)
+#endif
diff --git a/sysdeps/x86_64/fpu/svml_s_atan2f8_core.S b/sysdeps/x86_64/fpu/svml_s_atan2f8_core.S
new file mode 100644
index 0000000..bfcdb3c
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_s_atan2f8_core.S
@@ -0,0 +1,29 @@
+/* Function atan2f 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 (_ZGVdN8vv_atan2f)
+WRAPPER_IMPL_AVX_ff _ZGVbN4vv_atan2f
+END (_ZGVdN8vv_atan2f)
+
+#ifndef USE_MULTIARCH
+ libmvec_hidden_def (_ZGVdN8vv_atan2f)
+#endif
diff --git a/sysdeps/x86_64/fpu/svml_s_atan2f8_core_avx.S b/sysdeps/x86_64/fpu/svml_s_atan2f8_core_avx.S
new file mode 100644
index 0000000..1aa8d05
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_s_atan2f8_core_avx.S
@@ -0,0 +1,25 @@
+/* Function atan2f 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(_ZGVcN8vv_atan2f)
+WRAPPER_IMPL_AVX_ff _ZGVbN4vv_atan2f
+END(_ZGVcN8vv_atan2f)
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx.c
new file mode 100644
index 0000000..e423bce
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx.c
@@ -0,0 +1 @@
+#include "test-double-libmvec-atan2.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx2.c b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx2.c
new file mode 100644
index 0000000..e423bce
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx2.c
@@ -0,0 +1 @@
+#include "test-double-libmvec-atan2.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx512f.c b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx512f.c
new file mode 100644
index 0000000..e423bce
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-atan2-avx512f.c
@@ -0,0 +1 @@
+#include "test-double-libmvec-atan2.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-atan2.c b/sysdeps/x86_64/fpu/test-double-libmvec-atan2.c
new file mode 100644
index 0000000..d0aa626
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-atan2.c
@@ -0,0 +1,3 @@
+#define LIBMVEC_TYPE double
+#define LIBMVEC_FUNC atan2
+#include "test-vector-abi-arg2.h"
diff --git a/sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c b/sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c
index b1981ac..37a7a1c 100644
--- a/sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (cosh), _ZGVbN2v_cosh)
VECTOR_WRAPPER (WRAPPER_NAME (expm1), _ZGVbN2v_expm1)
VECTOR_WRAPPER (WRAPPER_NAME (sinh), _ZGVbN2v_sinh)
VECTOR_WRAPPER (WRAPPER_NAME (cbrt), _ZGVbN2v_cbrt)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2), _ZGVbN2vv_atan2)
#define VEC_INT_TYPE __m128i
diff --git a/sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c b/sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c
index 47915a7..4313f67 100644
--- a/sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c
@@ -40,6 +40,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (cosh), _ZGVdN4v_cosh)
VECTOR_WRAPPER (WRAPPER_NAME (expm1), _ZGVdN4v_expm1)
VECTOR_WRAPPER (WRAPPER_NAME (sinh), _ZGVdN4v_sinh)
VECTOR_WRAPPER (WRAPPER_NAME (cbrt), _ZGVdN4v_cbrt)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2), _ZGVdN4vv_atan2)
#ifndef __ILP32__
# define VEC_INT_TYPE __m256i
diff --git a/sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c b/sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c
index 5cd5049..4b8b00f 100644
--- a/sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (cosh), _ZGVcN4v_cosh)
VECTOR_WRAPPER (WRAPPER_NAME (expm1), _ZGVcN4v_expm1)
VECTOR_WRAPPER (WRAPPER_NAME (sinh), _ZGVcN4v_sinh)
VECTOR_WRAPPER (WRAPPER_NAME (cbrt), _ZGVcN4v_cbrt)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2), _ZGVcN4vv_atan2)
#define VEC_INT_TYPE __m128i
diff --git a/sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c b/sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c
index 8397073..d06522a 100644
--- a/sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (cosh), _ZGVeN8v_cosh)
VECTOR_WRAPPER (WRAPPER_NAME (expm1), _ZGVeN8v_expm1)
VECTOR_WRAPPER (WRAPPER_NAME (sinh), _ZGVeN8v_sinh)
VECTOR_WRAPPER (WRAPPER_NAME (cbrt), _ZGVeN8v_cbrt)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2), _ZGVeN8vv_atan2)
#ifndef __ILP32__
# define VEC_INT_TYPE __m512i
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx.c b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx.c
new file mode 100644
index 0000000..5c7e2c9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx.c
@@ -0,0 +1 @@
+#include "test-float-libmvec-atan2f.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx2.c b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx2.c
new file mode 100644
index 0000000..5c7e2c9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx2.c
@@ -0,0 +1 @@
+#include "test-float-libmvec-atan2f.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx512f.c b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx512f.c
new file mode 100644
index 0000000..5c7e2c9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f-avx512f.c
@@ -0,0 +1 @@
+#include "test-float-libmvec-atan2f.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-atan2f.c b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f.c
new file mode 100644
index 0000000..beb5c74
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-atan2f.c
@@ -0,0 +1,3 @@
+#define LIBMVEC_TYPE float
+#define LIBMVEC_FUNC atan2f
+#include "test-vector-abi-arg2.h"
diff --git a/sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c b/sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c
index 0420f11..0bd631b 100644
--- a/sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (coshf), _ZGVeN16v_coshf)
VECTOR_WRAPPER (WRAPPER_NAME (expm1f), _ZGVeN16v_expm1f)
VECTOR_WRAPPER (WRAPPER_NAME (sinhf), _ZGVeN16v_sinhf)
VECTOR_WRAPPER (WRAPPER_NAME (cbrtf), _ZGVeN16v_cbrtf)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2f), _ZGVeN16vv_atan2f)
#define VEC_INT_TYPE __m512i
diff --git a/sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c b/sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c
index c8f7580..1018398 100644
--- a/sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (coshf), _ZGVbN4v_coshf)
VECTOR_WRAPPER (WRAPPER_NAME (expm1f), _ZGVbN4v_expm1f)
VECTOR_WRAPPER (WRAPPER_NAME (sinhf), _ZGVbN4v_sinhf)
VECTOR_WRAPPER (WRAPPER_NAME (cbrtf), _ZGVbN4v_cbrtf)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2f), _ZGVbN4vv_atan2f)
#define VEC_INT_TYPE __m128i
diff --git a/sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c b/sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c
index b581796..42ea28f 100644
--- a/sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c
@@ -40,6 +40,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (coshf), _ZGVdN8v_coshf)
VECTOR_WRAPPER (WRAPPER_NAME (expm1f), _ZGVdN8v_expm1f)
VECTOR_WRAPPER (WRAPPER_NAME (sinhf), _ZGVdN8v_sinhf)
VECTOR_WRAPPER (WRAPPER_NAME (cbrtf), _ZGVdN8v_cbrtf)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2f), _ZGVdN8vv_atan2f)
/* Redefinition of wrapper to be compatible with _ZGVdN8vvv_sincosf. */
#undef VECTOR_WRAPPER_fFF
diff --git a/sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c b/sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c
index f16789e..70a0216 100644
--- a/sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c
+++ b/sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c
@@ -37,6 +37,7 @@ VECTOR_WRAPPER (WRAPPER_NAME (coshf), _ZGVcN8v_coshf)
VECTOR_WRAPPER (WRAPPER_NAME (expm1f), _ZGVcN8v_expm1f)
VECTOR_WRAPPER (WRAPPER_NAME (sinhf), _ZGVcN8v_sinhf)
VECTOR_WRAPPER (WRAPPER_NAME (cbrtf), _ZGVcN8v_cbrtf)
+VECTOR_WRAPPER_ff (WRAPPER_NAME (atan2f), _ZGVcN8vv_atan2f)
#define VEC_INT_TYPE __m128i