This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fortran vector math header creation


Hi.

I've working on SIMD support for Fortran and I've got a GCC patch
ready to be installed:
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01622.html

Now I would need to generate math-vector-fortran.h header file in glibc.
Can be generated from math-vector.h via attached following script.

$ cat math-vector.h | ./generate-fortran-math-vector.py > math-vector-fortran.h && cat math-vector-fortran.h
!GCC$ builtin (cos) attributes simd (notinbranch)
!GCC$ builtin (cosf) attributes simd (notinbranch)
!GCC$ builtin (sin) attributes simd (notinbranch)
!GCC$ builtin (sinf) attributes simd (notinbranch)
!GCC$ builtin (sincos) attributes simd (notinbranch)
!GCC$ builtin (sincosf) attributes simd (notinbranch)
!GCC$ builtin (log) attributes simd (notinbranch)
!GCC$ builtin (logf) attributes simd (notinbranch)
!GCC$ builtin (exp) attributes simd (notinbranch)
!GCC$ builtin (expf) attributes simd (notinbranch)
!GCC$ builtin (pow) attributes simd (notinbranch)
!GCC$ builtin (powf) attributes simd (notinbranch)

Can you please help me how to integrate that to glibc build process?
Do you use a scripting language?

Thanks,
Martin
#!/usr/bin/env python3

import fileinput

# sample declarations:
#  define __DECL_SIMD_cos __DECL_SIMD_x86_64

for line in fileinput.input():
    parts = [x for x in line.strip().split(' ') if x]
    s = '__DECL_SIMD_'
    if (len(parts) == 4 and parts[1] == 'define'
        and parts[-1] == '__DECL_SIMD_x86_64'):
            fn = parts[2]
            assert fn.startswith(s)
            fn =fn[len(s):]
            print('!GCC$ builtin (%s) attributes simd (notinbranch)' % fn)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]