#include "parse.h"
#include "constructor.h"
#include "target.h"
+#include "flags.h"
/* Macros to access allocate memory for gfc_data_variable,
gfc_data_value and gfc_data. */
if (gfc_match (" if ( '%n' ) ", target) == MATCH_YES)
{
- const char *abi = targetm.get_multilib_abi_name ();
- if (abi == NULL || strcmp (abi, target) != 0)
- return MATCH_YES;
+ if (strcmp (target, "fastmath") == 0)
+ {
+ if (!fast_math_flags_set_p (&global_options))
+ return MATCH_YES;
+ }
+ else
+ {
+ const char *abi = targetm.get_multilib_abi_name ();
+ if (abi == NULL || strcmp (abi, target) != 0)
+ return MATCH_YES;
+ }
}
if (gfc_vectorized_builtins == NULL)
!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
@end smallexample
+The special target @code{'fastmath'} is used to specify the vector
+implementation is only valid if fast-math is enabled:
+
+@smallexample
+!GCC$ builtin (exp) attributes simd (notinbranch) if('fastmath')
+@end smallexample
+
The purpose of the directive is to provide an API among the GCC compiler and
the GNU C Library which would define vector implementations of math routines.
--- /dev/null
+! { dg-do compile { target { aarch64*-*-linux* } } }
+! { dg-additional-options "-nostdinc -O3 -fpre-include=simd-builtins-9.h -fdump-tree-optimized" }
+
+program test_overloaded_intrinsic
+ real(8) :: x8(3200), y8(3200)
+
+ y8 = sin(x8)
+ print *, y8
+
+ x8 = cos(y8)
+ print *, x8
+end
+
+! { dg-final { scan-tree-dump-not "sin.simdclone" "optimized" } } */
+
+! { dg-final { scan-tree-dump "cos.simdclone" "optimized" } } */
--- /dev/null
+!GCC$ builtin (sin) attributes simd (notinbranch) if('fastmath')
+!GCC$ builtin (cos) attributes simd (notinbranch)