1 /* Platform-specific SIMD declarations of math functions.
2    Copyright (C) 2014-2021 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _MATH_H
20 # error "Never include <bits/math-vector.h> directly;\
21  include <math.h> instead."
22 #endif
23 
24 /* Get default empty definitions for simd declarations.  */
25 #include <bits/libm-simd-decl-stubs.h>
26 
27 #if defined __x86_64__ && defined __FAST_MATH__
28 # if defined _OPENMP && _OPENMP >= 201307
29 /* OpenMP case.  */
30 #  define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
31 # elif __GNUC_PREREQ (6,0)
32 /* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)).  */
33 #  define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
34 # endif
35 
36 # ifdef __DECL_SIMD_x86_64
37 #  undef __DECL_SIMD_cos
38 #  define __DECL_SIMD_cos __DECL_SIMD_x86_64
39 #  undef __DECL_SIMD_cosf
40 #  define __DECL_SIMD_cosf __DECL_SIMD_x86_64
41 #  undef __DECL_SIMD_sin
42 #  define __DECL_SIMD_sin __DECL_SIMD_x86_64
43 #  undef __DECL_SIMD_sinf
44 #  define __DECL_SIMD_sinf __DECL_SIMD_x86_64
45 #  undef __DECL_SIMD_sincos
46 #  define __DECL_SIMD_sincos __DECL_SIMD_x86_64
47 #  undef __DECL_SIMD_sincosf
48 #  define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
49 #  undef __DECL_SIMD_log
50 #  define __DECL_SIMD_log __DECL_SIMD_x86_64
51 #  undef __DECL_SIMD_logf
52 #  define __DECL_SIMD_logf __DECL_SIMD_x86_64
53 #  undef __DECL_SIMD_exp
54 #  define __DECL_SIMD_exp __DECL_SIMD_x86_64
55 #  undef __DECL_SIMD_expf
56 #  define __DECL_SIMD_expf __DECL_SIMD_x86_64
57 #  undef __DECL_SIMD_pow
58 #  define __DECL_SIMD_pow __DECL_SIMD_x86_64
59 #  undef __DECL_SIMD_powf
60 #  define __DECL_SIMD_powf __DECL_SIMD_x86_64
61 #  undef __DECL_SIMD_acos
62 #  define __DECL_SIMD_acos __DECL_SIMD_x86_64
63 #  undef __DECL_SIMD_acosf
64 #  define __DECL_SIMD_acosf __DECL_SIMD_x86_64
65 
66 # endif
67 #endif
68