This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] x86_64: Utilize vector math functions w/o -fopenmp
- From: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 4 Dec 2015 17:59:08 +0300
- Subject: [PATCH] x86_64: Utilize vector math functions w/o -fopenmp
- Authentication-results: sourceware.org; auth=none
Hi,
this patch adds GCC 6.* __attribute__((__simd__)) to declaration of
vector math functions to utilize them w/o -fopenmp.
Libmvec wike page will be updated appropriately with example of usage
(w/o -fopenmp will be needed -ftree-loop-vectorize).
2015-12-04 Andrew Senkevich <andrew.senkevich@intel.com>
* sysdeps/x86/fpu/bits/math-vector.h: Add __attribute__((__simd__)) to
vector functions declaration.
diff --git a/sysdeps/x86/fpu/bits/math-vector.h
b/sysdeps/x86/fpu/bits/math-vector.h
index f3bfb86..155d326 100644
--- a/sysdeps/x86/fpu/bits/math-vector.h
+++ b/sysdeps/x86/fpu/bits/math-vector.h
@@ -53,5 +53,32 @@
# undef __DECL_SIMD_powf
# define __DECL_SIMD_powf __DECL_SIMD_x86_64
+# 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
+# undef __DECL_SIMD_cosf
+# define __DECL_SIMD_cosf __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_sin
+# define __DECL_SIMD_sin __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_sinf
+# define __DECL_SIMD_sinf __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_sincos
+# define __DECL_SIMD_sincos __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_sincosf
+# define __DECL_SIMD_sincosf __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_log
+# define __DECL_SIMD_log __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_logf
+# define __DECL_SIMD_logf __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_exp
+# define __DECL_SIMD_exp __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_expf
+# define __DECL_SIMD_expf __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_pow
+# define __DECL_SIMD_pow __ATTR_SIMD_x86_64
+# undef __DECL_SIMD_powf
+# define __DECL_SIMD_powf __ATTR_SIMD_x86_64
# endif
#endif
Is it Ok for trunk?
--
WBR,
Andrew