This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86_64: Utilize vector math functions w/o -fopenmp
- From: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 4 Dec 2015 20:27:45 +0300
- Subject: Re: [PATCH] x86_64: Utilize vector math functions w/o -fopenmp
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3tOcznwyGywfCLf1baLW6rLyUdnX1SZe6-AGh41Wb0mqA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1512041544170 dot 29136 at digraph dot polyomino dot org dot uk>
2015-12-04 18:46 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Fri, 4 Dec 2015, Andrew Senkevich wrote:
>
>> +# elif __GNUC_PREREQ (6,0)
>> +/* W/o OpenMP use GCC 6.* __attribute__((__simd__)). */
>> +# define __ATTR_SIMD_x86_64 __attribute__((__simd__("notinbranch")))
>> +# undef __DECL_SIMD_cos
>> +# define __DECL_SIMD_cos __ATTR_SIMD_x86_64
>
> Why do you need to duplicate the list of functions? It would seem better
> to define __DECL_SIMD_x86_64 with two different definitions depending on
> the macros predefined by the compiler, then define all the
> __DECL_SIMD_<func> macros if __DECL_SIMD_x86_64 has been defined.
>
> # if defined _OPENMP && _OPENMP >= 201307
> # define __DECL_SIMD_x86_64 ...
> # elif __GNUC_PREREQ (6,0)
> # define __DECL_SIMD_x86_64 ...
> # endif
> # ifdef __DECL_SIMD_x86_64
> # undef __DECL_SIMD_cos
> # define __DECL_SIMD_cos __DECL_SIMD_x86_64
> etc.
Indeed, and patch became much shorter
diff --git a/sysdeps/x86/fpu/bits/math-vector.h
b/sysdeps/x86/fpu/bits/math-vector.h
index f3bfb86..13d720e 100644
--- a/sysdeps/x86/fpu/bits/math-vector.h
+++ b/sysdeps/x86/fpu/bits/math-vector.h
@@ -28,6 +28,12 @@
# if defined _OPENMP && _OPENMP >= 201307
/* OpenMP case. */
# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
+# elif __GNUC_PREREQ (6,0)
+/* W/o OpenMP use GCC 6.* __attribute__((__simd__)). */
+# define __DECL_SIMD_x86_64 __attribute__((__simd__("notinbranch")))
+# endif
+
+# ifdef __DECL_SIMD_x86_64
# undef __DECL_SIMD_cos
# define __DECL_SIMD_cos __DECL_SIMD_x86_64
# undef __DECL_SIMD_cosf
--
WBR,
Andrew