This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH x86-64][BZ #20024] Fixed vector sincos/sincosf ABI
- From: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "Carlos O'Donell" <carlos at redhat dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 1 Jul 2016 14:53:10 +0300
- Subject: Re: [PATCH x86-64][BZ #20024] Fixed vector sincos/sincosf ABI
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3tO0RGFjbrQaEV80rTCWmUy8LQjkZ7gRd9j+Q3YQ2+nAQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606022247540 dot 9542 at digraph dot polyomino dot org dot uk> <CAMXFM3vREvMPjBU23ZGV6eyNs-exwHGG6C2WE6N1MHf=CqbkvA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606061404540 dot 15183 at digraph dot polyomino dot org dot uk> <57560F10 dot 4040907 at redhat dot com> <CAMXFM3snbXbRLRuCTRgtnp4QLsfvtWYSZx=mT6qdFC+HYPYTkQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606221501480 dot 29819 at digraph dot polyomino dot org dot uk> <CAMXFM3szjuStPa3VgQ2ivkxbLX0fYTSYP6fU_qzN4eqNoCcqEg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606221754240 dot 29819 at digraph dot polyomino dot org dot uk> <CAMXFM3ttTxYHOp-doov0Op2AztD1YSwcDYPiHTCScv_fDaS5Kg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606292154440 dot 18822 at digraph dot polyomino dot org dot uk> <CAMXFM3tBickW2_OMpHUFuWEmrj5vt1=fxLbcR--_E0f8YLp+hg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606301346280 dot 27126 at digraph dot polyomino dot org dot uk> <CAMXFM3t6NBtojZ1Qn15119bN+_mahPTM=W17X795BYDYp4YqJQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606302225400 dot 21713 at digraph dot polyomino dot org dot uk>
2016-07-01 1:25 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Thu, 30 Jun 2016, Andrew Senkevich wrote:
>
>> 2016-06-30 16:46 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
>> > On Thu, 30 Jun 2016, Andrew Senkevich wrote:
>> >
>> >> Indeed, it can be simplified now.
>> >>
>> >> Is it Ok with that change for trunk as well as for 2.22 and 2.23
>> >> release branches?
>> >
>> > Please send the actual patch you are proposing.
>>
>> Here is attached.
>
> This one is OK.
Thanks.
What about a followup fix for trunk which adds "linear" versions? May
be create according bugzilla bug?
Proposed patch is:
* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
* sysdeps/x86_64/fpu/Versions: New versions added.
* sysdeps/x86/fpu/bits/math-vector.h: Added sincos/sincosf vector
declaration with linear clause.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos.c: Added ABI test for
vector sincos declared with linear clause.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c: Likewise for sincosf.
diff --git a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
index 80d028a..e3e450c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
@@ -47,3 +47,12 @@ GLIBC_2.22 _ZGVeN8v_log F
GLIBC_2.22 _ZGVeN8v_sin F
GLIBC_2.22 _ZGVeN8vv_pow F
GLIBC_2.22 _ZGVeN8vvv_sincos F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 _ZGVbN2vl8l8_sincos F
+GLIBC_2.24 _ZGVbN4vl4l4_sincosf F
+GLIBC_2.24 _ZGVcN4vl8l8_sincos F
+GLIBC_2.24 _ZGVcN8vl4l4_sincosf F
+GLIBC_2.24 _ZGVdN4vl8l8_sincos F
+GLIBC_2.24 _ZGVdN8vl4l4_sincosf F
+GLIBC_2.24 _ZGVeN16vl4l4_sincosf F
+GLIBC_2.24 _ZGVeN8vl8l8_sincos F
diff --git a/sysdeps/x86/fpu/bits/math-vector.h
b/sysdeps/x86/fpu/bits/math-vector.h
old mode 100644
new mode 100755
index ca43cf4..c20715b
--- a/sysdeps/x86/fpu/bits/math-vector.h
+++ b/sysdeps/x86/fpu/bits/math-vector.h
@@ -28,9 +28,11 @@
# if defined _OPENMP && _OPENMP >= 201307
/* OpenMP case. */
# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
+# define __DECL_SIMD_x86_64_sincos __DECL_SIMD_x86_64 _Pragma ("omp
declare simd notinbranch linear (__sinx, __cosx: 1)")
# elif __GNUC_PREREQ (6,0)
/* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */
# define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
+# define __DECL_SIMD_x86_64_sincos __DECL_SIMD_x86_64
# endif
# ifdef __DECL_SIMD_x86_64
@@ -43,9 +45,9 @@
# undef __DECL_SIMD_sinf
# define __DECL_SIMD_sinf __DECL_SIMD_x86_64
# undef __DECL_SIMD_sincos
-# define __DECL_SIMD_sincos __DECL_SIMD_x86_64
+# define __DECL_SIMD_sincos __DECL_SIMD_x86_64_sincos
# undef __DECL_SIMD_sincosf
-# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
+# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64_sincos
# undef __DECL_SIMD_log
# define __DECL_SIMD_log __DECL_SIMD_x86_64
# undef __DECL_SIMD_logf
diff --git a/sysdeps/x86_64/fpu/Versions b/sysdeps/x86_64/fpu/Versions
index 0813204..02df4b5 100644
--- a/sysdeps/x86_64/fpu/Versions
+++ b/sysdeps/x86_64/fpu/Versions
@@ -13,4 +13,8 @@ libmvec {
_ZGVbN4vv_powf; _ZGVcN8vv_powf; _ZGVdN8vv_powf; _ZGVeN16vv_powf;
_ZGVbN4vvv_sincosf; _ZGVcN8vvv_sincosf; _ZGVdN8vvv_sincosf;
_ZGVeN16vvv_sincosf;
}
+ GLIBC_2.24 {
+ _ZGVbN2vl8l8_sincos; _ZGVcN4vl8l8_sincos; _ZGVdN4vl8l8_sincos;
_ZGVeN8vl8l8_sincos;
+ _ZGVbN4vl4l4_sincosf; _ZGVcN8vl4l4_sincosf; _ZGVdN8vl4l4_sincosf;
_ZGVeN16vl4l4_sincosf;
+ }
}
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
index 80348a2..8fe106d 100644
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
@@ -21,6 +21,7 @@
#define N 1000
double x[N], s[N], c[N];
+double x1[N], s1[N], c1[N];
double* s_ptrs[N];
double* c_ptrs[N];
int arch_check = 1;
@@ -28,15 +29,13 @@ int arch_check = 1;
static void
init_arg (void)
{
- int i;
-
CHECK_ARCH_EXT;
arch_check = 0;
- for(i = 0; i < N; i++)
+ for(int i = 0; i < N; i++)
{
- x[i] = i / 3;
+ x[i] = x1[i] = i / 3;
s_ptrs[i] = &s[i];
c_ptrs[i] = &c[i];
}
@@ -45,16 +44,19 @@ init_arg (void)
static int
test_sincos_abi (void)
{
- int i;
-
- init_arg ();
+#pragma omp simd
+ for(int i = 0; i < N; i++)
+ sincos (x[i], s_ptrs[i], c_ptrs[i]);
- if (arch_check)
- return 77;
+ return 0;
+}
+static int
+test_sincos_linear_abi (void)
+{
#pragma omp simd
- for(i = 0; i < N; i++)
- sincos (x[i], s_ptrs[i], c_ptrs[i]);
+ for(int i = 0; i < N; i++)
+ sincos (x1[i], &s1[i], &c1[i]);
return 0;
}
@@ -62,7 +64,16 @@ test_sincos_abi (void)
static int
do_test (void)
{
- return test_sincos_abi ();
+ init_arg ();
+
+ if (arch_check)
+ return 77;
+
+ test_sincos_abi ();
+
+ test_sincos_linear_abi ();
+
+ return 0;
}
#define TEST_FUNCTION do_test ()
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
index 3b7aad8..fac2152 100644
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
@@ -21,22 +21,21 @@
#define N 1000
float x[N], s[N], c[N];
-float *s_ptrs[N];
-float *c_ptrs[N];
+float x1[N], s1[N], c1[N];
+float* s_ptrs[N];
+float* c_ptrs[N];
int arch_check = 1;
static void
init_arg (void)
{
- int i;
-
CHECK_ARCH_EXT;
arch_check = 0;
- for(i = 0; i < N; i++)
+ for(int i = 0; i < N; i++)
{
- x[i] = i / 3;
+ x[i] = x1[i] = i / 3;
s_ptrs[i] = &s[i];
c_ptrs[i] = &c[i];
}
@@ -45,16 +44,19 @@ init_arg (void)
static int
test_sincosf_abi (void)
{
- int i;
-
- init_arg ();
+#pragma omp simd
+ for(int i = 0; i < N; i++)
+ sincosf (x[i], s_ptrs[i], c_ptrs[i]);
- if (arch_check)
- return 77;
+ return 0;
+}
+static int
+test_sincosf_linear_abi (void)
+{
#pragma omp simd
- for(i = 0; i < N; i++)
- sincosf (x[i], s_ptrs[i], c_ptrs[i]);
+ for(int i = 0; i < N; i++)
+ sincosf (x1[i], &s1[i], &c1[i]);
return 0;
}
@@ -62,7 +64,16 @@ test_sincosf_abi (void)
static int
do_test (void)
{
- return test_sincosf_abi ();
+ init_arg ();
+
+ if (arch_check)
+ return 77;
+
+ test_sincosf_abi ();
+
+ test_sincosf_linear_abi ();
+
+ return 0;
}
#define TEST_FUNCTION do_test ()
--
WBR,
Andrew