This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/14] [x86_64] Vector math functions (vector cos)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 15 May 2015 16:54:29 +0000
- Subject: Re: [PATCH 1/14] [x86_64] Vector math functions (vector cos)
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3t+v7zYEmvWQxV9aRmJB6Ag2hQgQ56cZJTDy=siRBszDw at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1504301541120 dot 23221 at digraph dot polyomino dot org dot uk> <CAMXFM3sVJ6vkEF7RqrrHczJSdF_-gr9Xog-zFcG3rjhOqgqjDw at mail dot gmail dot com> <555622E1 dot 10604 at arm dot com>
On Fri, 15 May 2015, Szabolcs Nagy wrote:
> > +#if defined __x86_64__ && defined __FAST_MATH__
> > +# if defined _OPENMP && _OPENMP >= 201307
> > +/* OpenMP case. */
> > +# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
> > +# undef __DECL_SIMD_cos
> > +# define __DECL_SIMD_cos __DECL_SIMD_x86_64
> > +# endif
> > +#endif
>
> why does math.h have #ifdef _OPENMP ? (and __FAST_MATH__)
Because this pragma to declare that the vector functions are available
(for the compiler to vectorize calls to scalar functions) is an OpenMP
pragma, only available when OpenMP is enabled. They might also be made
available in other cases in future when appropriate pragmas (e.g.
CilkPlus) are available. __FAST_MATH__ is because these functions may not
meet the normal glibc rules regarding accuracy of results and exceptions.
See the discussions starting last September of the approach for adding
vector libm functions.
--
Joseph S. Myers
joseph@codesourcery.com