[PATCH][RFC]Overloading intrinsics
Martin Liška
mliska@suse.cz
Mon Nov 12 08:43:00 GMT 2018
On 11/10/18 1:20 PM, Thomas Koenig wrote:
> Hi Martin,
>
>> I'm sending another version of the patch that implements that. I know we are quite
>> close to the end of stage1, but I would be very happy to have it included in GCC 9.1.
>> Is it doable?
>
> First, I thinkt he concept is fine.
Hi.
Thanks.
>
> If possible, I would prefer a different name - this is really an include
> fine, not a free-form Fortran file. There is no common convention
> what to call Fortran include files, but *.inc seems to be common,
> and we are also using *.h for other stuff. So maybe *.h would
> be best.
Works for me, then I'm suggesting following name: math-vector-fortran.h.
>
> With your patch, exactly where would the file in question need
> to be located in order to be found? I suppose under the
> finclude directory might be a good idea.
Well, I would generally copy what we do for stdc-predef.h. The file
lives in glibc repository (./include/stdc-predef.h) and is then
distributed via a glibc-devel package. Then the file is installed
into /usr/include/stdc-predef.h. So a standard include directory.
We would also need to come up with a default empty file for non-x86_64
targets.
>
> Finally, how do we generate the file to be included? My
> suggestion would be to use something like
>
> $ cat tst.c
> #include <math.h>
> $ cat c2f.pl
> #! /usr/bin/perl
>
> while (<>) {
> Â Â Â next unless /notinbranch/;
> Â Â Â @arr = split(';');
> Â Â Â foreach $a (@arr) {
> Â Â Â Â Â Â Â next unless $a =~ /notinbranch/;
> Â Â Â Â Â Â Â $a =~ s/__attribute__ \(\(.*?\)\)*//g;
> Â Â Â Â Â Â Â $a =~ s/\(.*\)//;
> Â Â Â Â Â Â Â @a = split(" ",$a);
> Â Â Â Â Â Â Â print '!GCC$ builtin ',$a[2]," attributes omp_simd_notinbranch\n";
> Â Â Â }
> }
> $ gcc -E -Ofast tst.c | ./c2f.pl
> !GCC$ builtin cos attributes omp_simd_notinbranch
> !GCC$ builtin sin attributes omp_simd_notinbranch
> !GCC$ builtin exp attributes omp_simd_notinbranch
> !GCC$ builtin log attributes omp_simd_notinbranch
> !GCC$ builtin pow attributes omp_simd_notinbranch
> !GCC$ builtin cosf attributes omp_simd_notinbranch
> !GCC$ builtin sinf attributes omp_simd_notinbranch
> !GCC$ builtin expf attributes omp_simd_notinbranch
> !GCC$ builtin logf attributes omp_simd_notinbranch
> !GCC$ builtin powf attributes omp_simd_notinbranch
Works for me, glibc has already some perl scripts, so that can be hopefully
included.
>
> but I am not sure how (or if) this would work with
> cross-compilation or if it is stable enough.
If I'm correct that should be resolved by inclusion of corresponding
cross header file for math-vector-fortran.h.
Martin
>
> Regards
>
> Â Â Â Â Thomas
More information about the Fortran
mailing list