[PATCH, fortran] Extend the builtin directive

Szabolcs Nagy Szabolcs.Nagy@arm.com
Thu Nov 14 20:33:00 GMT 2019


The builtin directive allows specifying the simd attribute for a builtin
function. Similarly how the C language simd attribtue got extended to
allow declaring a specific vector variant, update the fortran builtin
directive too.

Before the patch, only the masking (inbranch/notinbranch) could be specified,
when declaring the availability of vector variants, e.g.:

 !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')

now the simdlen and simdabi (aka ISA) can be specified too, and a different
name may be used instead of the vector ABI name, e.g.:

 !GCC$ builtin (expf) attributes simd (notinbranch, 4, 'b', 'vexpf') if('x86_64')

Tested on aarch64-linux-gnu.

The C language change is at

https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01288.html

Note: I don't have much fortran experience, so i'm not sure if the syntax
makes sense or if i modified the frontend reasonably.

2019-11-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* gfortran.h (struct gfc_vect_builtin): Define.
	* decl.c (gfc_match_gcc_builtin): Parse new flags.
	* trans-intrinsic.c (add_simd_flag_for_built_in): Update.
	(gfc_adjust_builtins): Update.

gcc/testsuite/ChangeLog:

2019-11-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* gfortran.dg/simd-builtins-9.f90: New test.
	* gfortran.dg/simd-builtins-9.h: New test.
	* gfortran.dg/simd-builtins-10.f90: New test.
	* gfortran.dg/simd-builtins-10.h: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fortran_simd.diff
Type: text/x-patch
Size: 12510 bytes
Desc: fortran_simd.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191114/00228512/attachment.bin>


More information about the Gcc-patches mailing list