new proposal to vector intrinsics
Sa Liu
SALIU@de.ibm.com
Mon Jan 21 17:38:00 GMT 2008
Tobias Burnus <burnus@net-b.de> wrote on 18.01.2008 19:12:44:
> Sa Liu wrote:
> > How about the changes in frontend concerning recognition of backend
> > builtins? Will this be acceptable in gfotran?
> It is not completely clear what you mean by this.
What I mean is about checking and resolving backend builtins. When reading
the generated mod file from vec_intrinsics module, the function name
builtin_vec_add_int is saved in the program's namespace, and its binding
label "__builtin_altivec_vadduwm" could be used to connect the backend
builtin, i.e. to bind this symbol's backend_decl with its function decl.
> module vec_intrinsics
> implicit none
>
> interface
> function builtin_vec_add_int(a, b) result(c) bind(c,
> name="__builtin_altivec_vadduwm")
> use, intrinsic :: iso_c_binding
> integer (c_int), intent(in):: a(4), b(4)
> integer(c_int) :: c(4)
> end function builtin_vec_add_int
Fortunately we already have these decls in frontend. When the frontend
initialize builtins, it also calls targetm.init_buitins() to initialize
backend builtins. The idea here is to build a new gfc_namspace, say
backend_intrinsic_namespace, then keep the decls in it, and later bind the
decls with there corresponding symbols in the interface module.
We thought about building the new namespace in gfc_builtin_function, and
in gfc_get_extern_function_decl, search the decl in this namespace, link
the symbol with it if found any, before the frontend builds a new one.
Through the backend_decl the frontend can then resolve the intrinsic
functions. This requires some changes in f95-lang.c and trans-decl.c.
> For the vector type
> itself, I assume one needs to support somewhere the conversion
> TYPE(vec_*) to attribute((vector)), even if the type itself is defined
> in a module.
We thought of adding a private component to the TYPE(vec_*) in order to
distinguish vector type from user defined derived types with the same
array components. Is the attribute((vector)) for the same purpose or
anything else?
Thanks!
Sa
More information about the Fortran
mailing list