https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119102

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Comparing the preprocessed source for the std.cc module definition file, I see
lots of lines with a simd attribute added when compiled with -Ofast:

--- std-O3.ii      2025-03-03 17:20:32.885607902 +0000
+++ std-Ofast.ii   2025-03-03 17:20:09.410578347 +0000
@@ -103248,49 +103248,49 @@
 # 313 "/usr/include/math.h" 2 3 4
 # 1 "/usr/include/bits/mathcalls.h" 1 3 4
 # 53 "/usr/include/bits/mathcalls.h" 3 4
- extern double acos (double __x) noexcept (true); extern double __acos (double
__x) noexcept (true);
+__attribute__ ((__simd__ ("notinbranch"))) extern double acos (double __x)
noexcept (true); extern double __acos (double __x) noexcept (true);


The attribute is added as a result of glibc <math.h> doing:

/* Get machine-dependent vector math functions declarations.  */
#include <bits/math-vector.h>

which does:

#if defined __x86_64__ && defined __FAST_MATH__
# 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

Reply via email to