On Thu, Jan 24, 2019 at 04:25:13PM +0100, Martin Liška wrote:
> @@ -11361,6 +11365,13 @@ gfc_match_gcc_builtin (void)
>    else if (gfc_match (" ( inbranch ) ") == MATCH_YES)
>      clause = SIMD_INBRANCH;
>  
> +  if (gfc_match (" if ( '%n' ) ", target) == MATCH_YES)

Not sure if it is clean enough to have the 's in there, rather than
matching there a string literal, requiring that it is a constant and getting
at the string in there.  But if this is fine with the Fortran maintainers, I
won't object.

Given the patches for aarch64, I'd think that in addition to the target
specific multilib strings it might be worth to handle here also the generic
lp64, ilp32 and llp64 strings (by checking the precision of the
corresponding C types) and perhaps also big-endian, little-endian and
pdp-endian.  This way, targets which have only those differences wouldn't
need to come up with their hooks.

> +! { dg-final { scan-tree-dump "sinf.simdclone" "optimized" { target ilp32 } 
> } } */
> +! { dg-final { scan-tree-dump-not "sin.simdclone" "optimized" { target ilp32 
> } } } */

I think you need ia32 here, otherwise it will fail on x32, which is also
ilp32 target, but not i386.

> +! { dg-final { scan-tree-dump "sin.simdclone" "optimized" { target lp64} } } 
> */
> +! { dg-final { scan-tree-dump-not "sinf.simdclone" "optimized" { target lp64 
> } } } */
> diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-7.h 
> b/gcc/testsuite/gfortran.dg/simd-builtins-7.h
> new file mode 100644
> index 00000000000..1c19b88f877
> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/simd-builtins-7.h
> @@ -0,0 +1,2 @@
> +!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
> +!GCC$ builtin (sinf) attributes simd (notinbranch) if('i386')

That is all from me, but I think you need a buy-in from the Fortran
maintainers (if they are ok with such an extension from Fortran language
POV) and from Joseph (or other glibc people).

        Jakub

Reply via email to